home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cocktail / cg.lha / cg / m2c / Order.c < prev    next >
C/C++ Source or Header  |  1992-11-24  |  82KB  |  2,719 lines

  1. #include "SYSTEM_.h"
  2.  
  3. #ifndef DEFINITION_System
  4. #include "System.h"
  5. #endif
  6.  
  7. #ifndef DEFINITION_IO
  8. #include "IO.h"
  9. #endif
  10.  
  11. #ifndef DEFINITION_Tree
  12. #include "Tree.h"
  13. #endif
  14.  
  15. #ifndef DEFINITION_Memory
  16. #include "Memory.h"
  17. #endif
  18.  
  19. #ifndef DEFINITION_DynArray
  20. #include "DynArray.h"
  21. #endif
  22.  
  23. #ifndef DEFINITION_IO
  24. #include "IO.h"
  25. #endif
  26.  
  27. #ifndef DEFINITION_Idents
  28. #include "Idents.h"
  29. #endif
  30.  
  31. #ifndef DEFINITION_Sets
  32. #include "Sets.h"
  33. #endif
  34.  
  35. #ifndef DEFINITION_Relations
  36. #include "Relations.h"
  37. #endif
  38.  
  39. #ifndef DEFINITION_Queue
  40. #include "Queue.h"
  41. #endif
  42.  
  43. #ifndef DEFINITION_Tree
  44. #include "Tree.h"
  45. #endif
  46.  
  47. #ifndef DEFINITION_Optimize
  48. #include "Optimize.h"
  49. #endif
  50.  
  51. #ifndef DEFINITION_Sets
  52. #include "Sets.h"
  53. #endif
  54.  
  55. #ifndef DEFINITION_Relations
  56. #include "Relations.h"
  57. #endif
  58.  
  59. #ifndef DEFINITION_Queue
  60. #include "Queue.h"
  61. #endif
  62.  
  63. #ifndef DEFINITION_Errors
  64. #include "Errors.h"
  65. #endif
  66.  
  67. #ifndef DEFINITION_Order
  68. #include "Order.h"
  69. #endif
  70.  
  71. struct Order_1 *Order_IndexToClass;
  72. IO_tFile Order_yyf;
  73. PROC Order_Exit;
  74.  
  75. #define GrammarIsInNormalForm    50
  76. #define GrammarIsNotInNormalForm    51
  77. #define SwitchedOnOptionL    52
  78. #define GrammarIsSAG    53
  79. #define GrammarIsLAG    54
  80. #define GrammarIsOAG    55
  81. #define GrammarIsDNC    56
  82. #define GrammarIsSNC    57
  83. #define GrammarIsWAG    58
  84. #define GrammarIsNotWAG    59
  85. #define CycleInSNC    60
  86. #define CycleInDNC    61
  87. #define CycleInOAG    62
  88. #define InternalErrorCompOAG    63
  89. #define CycleInWAG    64
  90. static Sets_tSet HasCycle, Children, Parents, Relevant, Cyclics, IsComputed, IsComputable;
  91. static SHORTCARD Prio, UserIndex, ClassCount, Kind, i, i2, j, k, n, Visit;
  92. static BOOLEAN Reporting, Success, Stable;
  93. static Tree_tTree ActClass, UserClass, ChildsClass;
  94. static Tree_tInstance AttrInstance;
  95. static LONGINT IndexSize;
  96. static BOOLEAN IsComputable3a ARGS((SHORTCARD i, Tree_tTree t));
  97. static BOOLEAN IsComputable3b ARGS((SHORTCARD i, Tree_tTree t));
  98. static void yyAbort ARGS((CHAR yyFunction[], LONGCARD ));
  99. static BOOLEAN yyIsEqual ARGS((BYTE yya[], LONGCARD , BYTE yyb[], LONGCARD ));
  100. struct S_3 {
  101.     union {
  102.         char dummy;
  103.     } U_1;
  104. };
  105. static void CompIndex ARGS((Tree_tTree t));
  106. struct S_4 {
  107.     union {
  108.         char dummy;
  109.     } U_1;
  110. };
  111. static void CompIndexToClass ARGS((Tree_tTree t));
  112. struct S_5 {
  113.     union {
  114.         char dummy;
  115.     } U_1;
  116. };
  117. static void CompUsers ARGS((Tree_tTree t));
  118. struct S_6 {
  119.     union {
  120.         char dummy;
  121.     } U_1;
  122. };
  123. static void CompSNC1 ARGS((Tree_tTree t));
  124. struct S_7 {
  125.     union {
  126.         char dummy;
  127.     } U_1;
  128. };
  129. static void CompSNC2 ARGS((Tree_tTree t));
  130. struct S_8 {
  131.     union {
  132.         char dummy;
  133.     } U_1;
  134. };
  135. static void CompDNC1 ARGS((Tree_tTree t));
  136. struct S_9 {
  137.     union {
  138.         char dummy;
  139.     } U_1;
  140. };
  141. static void CompDNC2 ARGS((Tree_tTree t));
  142. struct S_10 {
  143.     union {
  144.         char dummy;
  145.     } U_1;
  146. };
  147. static void CompOAG0a ARGS((Tree_tTree t));
  148. struct S_11 {
  149.     union {
  150.         char dummy;
  151.     } U_1;
  152. };
  153. static void CompOAG0b ARGS((Tree_tTree t));
  154. struct S_12 {
  155.     union {
  156.         char dummy;
  157.     } U_1;
  158. };
  159. static void CompOAG0c ARGS((Tree_tTree t));
  160. struct S_13 {
  161.     union {
  162.         char dummy;
  163.     } U_1;
  164. };
  165. static void CompOAG0d ARGS((Tree_tTree t));
  166. struct S_14 {
  167.     union {
  168.         char dummy;
  169.     } U_1;
  170. };
  171. static void CompOAG0e ARGS((Tree_tTree t));
  172. struct S_15 {
  173.     union {
  174.         char dummy;
  175.     } U_1;
  176. };
  177. static void CompOAG1 ARGS((Tree_tTree t));
  178. struct S_16 {
  179.     union {
  180.         char dummy;
  181.     } U_1;
  182. };
  183. static void CompOAG2 ARGS((Tree_tTree t));
  184. struct S_17 {
  185.     union {
  186.         char dummy;
  187.     } U_1;
  188. };
  189. static void CompOAG3a ARGS((Tree_tTree t));
  190. struct S_18 {
  191.     union {
  192.         char dummy;
  193.     } U_1;
  194. };
  195. static void CompOAG3b ARGS((Tree_tTree t));
  196. struct S_19 {
  197.     union {
  198.         char dummy;
  199.     } U_1;
  200. };
  201. struct S_20 {
  202.     union {
  203.         char dummy;
  204.     } U_1;
  205. };
  206. struct S_21 {
  207.     union {
  208.         char dummy;
  209.     } U_1;
  210. };
  211. struct S_22 {
  212.     union {
  213.         char dummy;
  214.     } U_1;
  215. };
  216. static void CheckNormalForm ARGS((Tree_tTree t));
  217. struct S_23 {
  218.     union {
  219.         char dummy;
  220.     } U_1;
  221. };
  222. static void CheckLAG ARGS((Tree_tTree t));
  223. struct S_24 {
  224.     union {
  225.         char dummy;
  226.     } U_1;
  227. };
  228. static void CheckSAG ARGS((Tree_tTree t));
  229. struct S_25 {
  230.     union {
  231.         char dummy;
  232.     } U_1;
  233. };
  234. static void InitWAG ARGS((Tree_tTree t));
  235. struct S_26 {
  236.     union {
  237.         char dummy;
  238.     } U_1;
  239. };
  240. static void CheckWAG0 ARGS((Tree_tTree t));
  241. struct S_27 {
  242.     union {
  243.         char dummy;
  244.     } U_1;
  245. };
  246. static void CheckWAG1 ARGS((Tree_tTree t));
  247. struct S_28 {
  248.     union {
  249.         struct {
  250.             struct S_29 {
  251.                 Relations_tRelation C_0_A;
  252.             } yyR1;
  253.         } V_1;
  254.     } U_1;
  255. };
  256. static void CheckWAG2 ARGS((Tree_tTree t));
  257. struct S_30 {
  258.     union {
  259.         struct {
  260.             struct S_31 {
  261.                 Relations_tRelation C_0_A;
  262.             } yyR1;
  263.         } V_1;
  264.     } U_1;
  265. };
  266. static void CheckWAG3 ARGS((Tree_tTree yyP2, Relations_tRelation yyP1));
  267. struct S_32 {
  268.     union {
  269.         char dummy;
  270.     } U_1;
  271. };
  272. static void CheckWAG4 ARGS((Tree_tTree yyP6, Relations_tRelation yyP5, Tree_tTree yyP4, Tree_tTree yyP3));
  273. struct S_33 {
  274.     union {
  275.         struct {
  276.             struct S_34 {
  277.                 Relations_tRelation B;
  278.                 Tree_tSetOfRelPtr ActD;
  279.             } yyR1;
  280.         } V_1;
  281.     } U_1;
  282. };
  283. static void CheckWAG5 ARGS((Tree_tTree t, Relations_tRelation yyP7));
  284. typedef Tree_tSetOfRelPtr *tSetOfRelPtrPtr;
  285. struct S_35 {
  286.     union {
  287.         struct {
  288.             struct S_36 {
  289.                 Relations_tRelation B;
  290.                 Tree_tSetOfRelPtr ActD;
  291.                 tSetOfRelPtrPtr LastNext;
  292.             } yyR1;
  293.         } V_1;
  294.     } U_1;
  295. };
  296. static void yyExit ARGS(());
  297.  
  298.  
  299. static BOOLEAN IsComputable3a
  300. # ifdef __STDC__
  301. (SHORTCARD i, Tree_tTree t)
  302. # else
  303. (i, t)
  304. SHORTCARD i;
  305. Tree_tTree t;
  306. # endif
  307. {
  308.   SHORTCARD j;
  309.  
  310.   {
  311.     register Tree_yClass *W_1 = &t->U_1.V_5.Class;
  312.  
  313.     {
  314.       SHORTCARD B_1 = 1, B_2 = W_1->InstCount;
  315.  
  316.       if (B_1 <= B_2)
  317.         for (j = B_1;; j += 1) {
  318.           if (Relations_IsRelated((LONGINT)i, (LONGINT)j, W_1->OAG) && !Sets_IsElement((LONGCARD)j, &IsComputed)) {
  319.             return FALSE;
  320.           }
  321.           if (j >= B_2) break;
  322.         }
  323.     }
  324.     return TRUE;
  325.   }
  326. }
  327.  
  328. static BOOLEAN IsComputable3b
  329. # ifdef __STDC__
  330. (SHORTCARD i, Tree_tTree t)
  331. # else
  332. (i, t)
  333. SHORTCARD i;
  334. Tree_tTree t;
  335. # endif
  336. {
  337.   SHORTCARD j;
  338.  
  339.   {
  340.     register Tree_yClass *W_2 = &t->U_1.V_5.Class;
  341.  
  342.     if (SET_IS_SUBSET1(SET_ELEM(Tree_Synthesized) | SET_ELEM(Tree_Right), W_2->Instance->A[i - 1].Properties) || SET_IS_SUBSET1(SET_ELEM(Tree_Inherited) | SET_ELEM(Tree_Left), W_2->Instance->A[i - 1].Properties)) {
  343.       {
  344.         SHORTCARD B_3 = 1, B_4 = W_2->InstCount;
  345.  
  346.         if (B_3 <= B_4)
  347.           for (j = B_3;; j += 1) {
  348.             if (IN(Tree_First, W_2->Instance->A[j - 1].Properties) && Relations_IsRelated((LONGINT)j, (LONGINT)i, W_2->OAG) && !Sets_IsElement((LONGCARD)j, &IsComputed)) {
  349.               return FALSE;
  350.             }
  351.             if (j >= B_4) break;
  352.           }
  353.       }
  354.     } else {
  355.       {
  356.         SHORTCARD B_5 = 1, B_6 = W_2->InstCount;
  357.  
  358.         if (B_5 <= B_6)
  359.           for (j = B_5;; j += 1) {
  360.             if (Relations_IsRelated((LONGINT)j, (LONGINT)i, W_2->OAG) && !Sets_IsElement((LONGCARD)j, &IsComputed)) {
  361.               return FALSE;
  362.             }
  363.             if (j >= B_6) break;
  364.           }
  365.       }
  366.     }
  367.     return TRUE;
  368.   }
  369. }
  370.  
  371. static void yyAbort
  372. # ifdef __STDC__
  373. (CHAR yyFunction[], LONGCARD O_1)
  374. # else
  375. (yyFunction, O_1)
  376. CHAR yyFunction[];
  377. LONGCARD O_1;
  378. # endif
  379. {
  380.   OPEN_ARRAY_LOCALS
  381.  
  382.   ALLOC_OPEN_ARRAYS(O_1 * sizeof(CHAR), 1)
  383.   COPY_OPEN_ARRAY(yyFunction, O_1, CHAR)
  384.   IO_WriteS((System_tFile)IO_StdError, (STRING)"Error: module Order, routine ", 29L);
  385.   IO_WriteS((System_tFile)IO_StdError, yyFunction, O_1);
  386.   IO_WriteS((System_tFile)IO_StdError, (STRING)" failed", 7L);
  387.   IO_WriteNl((System_tFile)IO_StdError);
  388.   (*Order_Exit)();
  389.   FREE_OPEN_ARRAYS
  390. }
  391.  
  392. static BOOLEAN yyIsEqual
  393. # ifdef __STDC__
  394. (BYTE yya[], LONGCARD O_3, BYTE yyb[], LONGCARD O_2)
  395. # else
  396. (yya, O_3, yyb, O_2)
  397. BYTE yya[];
  398. LONGCARD O_3;
  399. BYTE yyb[];
  400. LONGCARD O_2;
  401. # endif
  402. {
  403.   INTEGER yyi;
  404.   OPEN_ARRAY_LOCALS
  405.  
  406.   ALLOC_OPEN_ARRAYS(O_2 * sizeof(WORD) + O_3 * sizeof(WORD), 2)
  407.   COPY_OPEN_ARRAY(yyb, O_2, WORD)
  408.   COPY_OPEN_ARRAY(yya, O_3, WORD)
  409.   {
  410.     LONGINT B_7 = 0, B_8 = (INTEGER)(O_3 - 1);
  411.  
  412.     if (B_7 <= B_8)
  413.       for (yyi = B_7;; yyi += 1) {
  414.         if (yya[yyi] != yyb[yyi]) {
  415.           FREE_OPEN_ARRAYS
  416.           return FALSE;
  417.         }
  418.         if (yyi >= B_8) break;
  419.       }
  420.   }
  421.   FREE_OPEN_ARRAYS
  422.   return TRUE;
  423. }
  424.  
  425. void Order_Order
  426. # ifdef __STDC__
  427. (Tree_tTree t)
  428. # else
  429. (t)
  430. Tree_tTree t;
  431. # endif
  432. {
  433.   struct S_3 yyTempo;
  434.  
  435.   if (t == Tree_NoTree) {
  436.     return;
  437.   }
  438.   if (t->U_1.V_1.Kind == Tree_Ag) {
  439.     {
  440.       register Tree_yAg *W_3 = &t->U_1.V_26.Ag;
  441.  
  442.       Order_Order(W_3->Classes);
  443.       return;
  444.     }
  445.   }
  446.   if (t->U_1.V_1.Kind == Tree_Class) {
  447.     {
  448.       register Tree_yClass *W_4 = &t->U_1.V_5.Class;
  449.  
  450.       Success = TRUE;
  451.       Tree_ForallClasses(t, (Tree_ProcOfT)CheckNormalForm);
  452.       if (Success) {
  453.         Tree_Information((LONGINT)GrammarIsInNormalForm, t->U_1.V_5.Class.Pos);
  454.       } else {
  455.         Tree_Information((LONGINT)GrammarIsNotInNormalForm, t->U_1.V_5.Class.Pos);
  456.       }
  457.       if (IN(Tree_cLNC, Tree_GrammarClass)) {
  458.         Tree_ForallClasses(t, (Tree_ProcOfT)CompIndex);
  459.         IndexSize = ClassCount + 1;
  460.         DynArray_MakeArray((ADDRESS *)&Order_IndexToClass, &IndexSize, (LONGINT)sizeof(Tree_tTree));
  461.         Queue_MakeQueue(ClassCount);
  462.         Sets_MakeSet(&HasCycle, (LONGCARD)ClassCount);
  463.         Tree_ForallClasses(t, (Tree_ProcOfT)CompIndexToClass);
  464.         Tree_ForallClasses(t, (Tree_ProcOfT)CompUsers);
  465.         while (!Queue_IsEmpty()) {
  466.           ActClass = Order_IndexToClass->A[Queue_Dequeue()];
  467.           Relations_Closure(&ActClass->U_1.V_5.Class.SNC);
  468.           CompSNC1(ActClass->U_1.V_5.Class.BaseClass);
  469.           {
  470.             SHORTCARD B_9 = Sets_Minimum(&ActClass->U_1.V_5.Class.Users), B_10 = Sets_Maximum(&ActClass->U_1.V_5.Class.Users);
  471.  
  472.             if (B_9 <= B_10)
  473.               for (UserIndex = B_9;; UserIndex += 1) {
  474.                 if (Sets_IsElement((LONGCARD)UserIndex, &ActClass->U_1.V_5.Class.Users)) {
  475.                   UserClass = Order_IndexToClass->A[UserIndex];
  476.                   Tree_ForallAttributes(UserClass, (Tree_ProcOfT)CompSNC1);
  477.                 }
  478.                 if (UserIndex >= B_10) break;
  479.               }
  480.           }
  481.         }
  482.         Tree_ForallClasses(t, (Tree_ProcOfT)CompSNC2);
  483.         if (Sets_IsEmpty(HasCycle)) {
  484.           INCL(Tree_GrammarClass, Tree_cSNC);
  485.         } else if (!Sets_IsElement(ORD('L'), &Tree_Options)) {
  486.           Tree_Information((LONGINT)SwitchedOnOptionL, t->U_1.V_5.Class.Pos);
  487.           Sets_Include(&Tree_Options, ORD('L'));
  488.         }
  489.         if (IN(Tree_cSNC, Tree_GrammarClass)) {
  490.           while (!Queue_IsEmpty()) {
  491.             ActClass = Order_IndexToClass->A[Queue_Dequeue()];
  492.             Relations_Closure(&ActClass->U_1.V_5.Class.DNC);
  493.             Tree_ForallClasses(ActClass->U_1.V_5.Class.Extensions, (Tree_ProcOfT)CompDNC1);
  494.             Tree_ForallAttributes(ActClass, (Tree_ProcOfT)CompDNC1);
  495.           }
  496.           Queue_ReleaseQueue();
  497.           Success = TRUE;
  498.           Tree_ForallClasses(t, (Tree_ProcOfT)CompDNC2);
  499.           if (Success) {
  500.             INCL(Tree_GrammarClass, Tree_cDNC);
  501.           } else if (!Sets_IsElement(ORD('L'), &Tree_Options)) {
  502.             Tree_Information((LONGINT)SwitchedOnOptionL, t->U_1.V_5.Class.Pos);
  503.             Sets_Include(&Tree_Options, ORD('L'));
  504.           }
  505.           if (IN(Tree_cDNC, Tree_GrammarClass)) {
  506.             if (Sets_IsElement(ORD('/'), &Tree_Options)) {
  507.               Tree_ForallClasses(t, (Tree_ProcOfT)CompOAG0a);
  508.             } else {
  509.               Tree_ForallClasses(t, (Tree_ProcOfT)CompOAG0b);
  510.               Tree_ForallClasses(t, (Tree_ProcOfT)CompOAG0c);
  511.               Tree_ForallClasses(t, (Tree_ProcOfT)CompOAG0d);
  512.             }
  513.             Tree_ForallClasses(t, (Tree_ProcOfT)CompOAG1);
  514.             Success = TRUE;
  515.             Tree_ForallClasses(t, (Tree_ProcOfT)CompOAG2);
  516.             if (Success) {
  517.               INCL(Tree_GrammarClass, Tree_cOAG);
  518.             } else if (!Sets_IsElement(ORD('L'), &Tree_Options)) {
  519.               Tree_Information((LONGINT)SwitchedOnOptionL, t->U_1.V_5.Class.Pos);
  520.               Sets_Include(&Tree_Options, ORD('L'));
  521.             }
  522.             if (IN(Tree_cOAG, Tree_GrammarClass)) {
  523.               if (!Sets_IsElement(ORD('L'), &Tree_Options)) {
  524.                 if (Sets_IsElement(ORD('/'), &Tree_Options)) {
  525.                   Tree_ForallClasses(t, (Tree_ProcOfT)CompOAG3a);
  526.                 } else {
  527.                   Tree_ForallClasses(t, (Tree_ProcOfT)CompOAG3b);
  528.                 }
  529.                 if (Sets_IsElement(ORD('0'), &Tree_Options)) {
  530.                   Tree_ForallClasses(t, (Tree_ProcOfT)Optimize_LifeTime1);
  531.                   if (Sets_IsElement(ORD('3'), &Tree_Options)) {
  532.                     IO_WriteNl((System_tFile)IO_StdOutput);
  533.                     IO_WriteS((System_tFile)IO_StdOutput, (STRING)"Attribute Storage Assignment", 28L);
  534.                     IO_WriteNl((System_tFile)IO_StdOutput);
  535.                     IO_WriteS((System_tFile)IO_StdOutput, (STRING)"----------------------------", 28L);
  536.                     IO_WriteNl((System_tFile)IO_StdOutput);
  537.                     IO_WriteNl((System_tFile)IO_StdOutput);
  538.                     Optimize_ChildrenDyn = 0;
  539.                     Optimize_ChildrenIn = 0;
  540.                     Optimize_AttributeIn = 0;
  541.                     Optimize_AttributeOut = 0;
  542.                     Optimize_AttributeTree = 0;
  543.                     Optimize_AttributeParam = 0;
  544.                     Optimize_AttributeVar = 0;
  545.                     Optimize_AttributeDemand = 0;
  546.                     Optimize_AttributeStack = 0;
  547.                   }
  548.                   Tree_ForallClasses(t, (Tree_ProcOfT)Optimize_LifeTime3);
  549.                   if (Sets_IsElement(ORD('3'), &Tree_Options)) {
  550.                     IO_WriteNl((System_tFile)IO_StdOutput);
  551.                     if (Optimize_ChildrenIn > 0) {
  552.                       IO_WriteS((System_tFile)IO_StdOutput, (STRING)"Children  Input        ", 17L);
  553.                       IO_WriteI((System_tFile)IO_StdOutput, (LONGINT)Optimize_ChildrenIn, 3L);
  554.                       IO_WriteNl((System_tFile)IO_StdOutput);
  555.                     }
  556.                     if (Optimize_ChildrenDyn > 0) {
  557.                       IO_WriteS((System_tFile)IO_StdOutput, (STRING)"Children  Dynamic    ", 18L);
  558.                       IO_WriteI((System_tFile)IO_StdOutput, (LONGINT)Optimize_ChildrenDyn, 3L);
  559.                       IO_WriteNl((System_tFile)IO_StdOutput);
  560.                     }
  561.                     if (Optimize_AttributeIn > 0) {
  562.                       IO_WriteS((System_tFile)IO_StdOutput, (STRING)"Attribute Input        ", 17L);
  563.                       IO_WriteI((System_tFile)IO_StdOutput, (LONGINT)Optimize_AttributeIn, 3L);
  564.                       IO_WriteNl((System_tFile)IO_StdOutput);
  565.                     }
  566.                     if (Optimize_AttributeOut > 0) {
  567.                       IO_WriteS((System_tFile)IO_StdOutput, (STRING)"Attribute Output    ", 17L);
  568.                       IO_WriteI((System_tFile)IO_StdOutput, (LONGINT)Optimize_AttributeOut, 3L);
  569.                       IO_WriteNl((System_tFile)IO_StdOutput);
  570.                     }
  571.                     if (Optimize_AttributeTree > 0) {
  572.                       IO_WriteS((System_tFile)IO_StdOutput, (STRING)"Attribute Tree        ", 16L);
  573.                       IO_WriteI((System_tFile)IO_StdOutput, (LONGINT)Optimize_AttributeTree, 3L);
  574.                       IO_WriteNl((System_tFile)IO_StdOutput);
  575.                     }
  576.                     if (Optimize_AttributeParam > 0) {
  577.                       IO_WriteS((System_tFile)IO_StdOutput, (STRING)"Attribute Parameter    ", 20L);
  578.                       IO_WriteI((System_tFile)IO_StdOutput, (LONGINT)Optimize_AttributeParam, 3L);
  579.                       IO_WriteNl((System_tFile)IO_StdOutput);
  580.                     }
  581.                     if (Optimize_AttributeVar > 0) {
  582.                       IO_WriteS((System_tFile)IO_StdOutput, (STRING)"Attribute Variable    ", 19L);
  583.                       IO_WriteI((System_tFile)IO_StdOutput, (LONGINT)Optimize_AttributeVar, 3L);
  584.                       IO_WriteNl((System_tFile)IO_StdOutput);
  585.                     }
  586.                     if (Optimize_AttributeDemand > 0) {
  587.                       IO_WriteS((System_tFile)IO_StdOutput, (STRING)"Attribute Demand    ", 17L);
  588.                       IO_WriteI((System_tFile)IO_StdOutput, (LONGINT)Optimize_AttributeDemand, 3L);
  589.                       IO_WriteNl((System_tFile)IO_StdOutput);
  590.                     }
  591.                     if (Optimize_AttributeStack > 0) {
  592.                       IO_WriteS((System_tFile)IO_StdOutput, (STRING)"Attribute Stack    ", 16L);
  593.                       IO_WriteI((System_tFile)IO_StdOutput, (LONGINT)Optimize_AttributeStack, 3L);
  594.                       IO_WriteNl((System_tFile)IO_StdOutput);
  595.                     }
  596.                   }
  597.                 }
  598.               }
  599.               Success = TRUE;
  600.               Tree_ForallClasses(t, (Tree_ProcOfT)CheckLAG);
  601.               if (Success) {
  602.                 INCL(Tree_GrammarClass, Tree_cLAG);
  603.               }
  604.               if (IN(Tree_cLAG, Tree_GrammarClass)) {
  605.                 Success = TRUE;
  606.                 Tree_ForallClasses(t, (Tree_ProcOfT)CheckSAG);
  607.                 if (Success) {
  608.                   INCL(Tree_GrammarClass, Tree_cSAG);
  609.                 }
  610.                 if (IN(Tree_cSAG, Tree_GrammarClass)) {
  611.                   Tree_Information((LONGINT)GrammarIsSAG, t->U_1.V_5.Class.Pos);
  612.                 } else {
  613.                   Tree_Information((LONGINT)GrammarIsLAG, t->U_1.V_5.Class.Pos);
  614.                 }
  615.               } else {
  616.                 Tree_Information((LONGINT)GrammarIsOAG, t->U_1.V_5.Class.Pos);
  617.               }
  618.             } else {
  619.               Tree_Information((LONGINT)GrammarIsDNC, t->U_1.V_5.Class.Pos);
  620.             }
  621.           } else {
  622.             Tree_Information((LONGINT)GrammarIsSNC, t->U_1.V_5.Class.Pos);
  623.           }
  624.         } else {
  625.           Queue_ReleaseQueue();
  626.           Queue_MakeQueue(ClassCount);
  627.           Sets_MakeSet(&Relevant, (LONGCARD)ClassCount);
  628.           Sets_MakeSet(&Cyclics, (LONGCARD)ClassCount);
  629.           Sets_Assign(&Cyclics, HasCycle);
  630.           while (!Sets_IsEmpty(Cyclics)) {
  631.             InitWAG(Order_IndexToClass->A[Sets_Extract(&Cyclics)]);
  632.           }
  633.           Reporting = FALSE;
  634.           while (!Sets_IsEmpty(HasCycle)) {
  635.             CheckWAG0(Order_IndexToClass->A[Sets_Extract(&HasCycle)]);
  636.           }
  637.           Sets_ReleaseSet(&Cyclics);
  638.           while (!Queue_IsEmpty()) {
  639.             CheckWAG2(Order_IndexToClass->A[Queue_Dequeue()]);
  640.           }
  641.           if (Sets_IsEmpty(HasCycle)) {
  642.             INCL(Tree_GrammarClass, Tree_cWAG);
  643.             Tree_Information((LONGINT)GrammarIsWAG, t->U_1.V_5.Class.Pos);
  644.           } else {
  645.             Reporting = TRUE;
  646.             while (!Sets_IsEmpty(HasCycle)) {
  647.               CheckWAG2(Order_IndexToClass->A[Sets_Extract(&HasCycle)]);
  648.             }
  649.             Tree_Information((LONGINT)GrammarIsNotWAG, t->U_1.V_5.Class.Pos);
  650.           }
  651.           Sets_ReleaseSet(&HasCycle);
  652.           Queue_ReleaseQueue();
  653.         }
  654.       } else {
  655.         Tree_Information((LONGINT)GrammarIsNotWAG, t->U_1.V_5.Class.Pos);
  656.       }
  657.       return;
  658.     }
  659.   }
  660. }
  661.  
  662. static void CompIndex
  663. # ifdef __STDC__
  664. (Tree_tTree t)
  665. # else
  666. (t)
  667. Tree_tTree t;
  668. # endif
  669. {
  670.   struct S_4 yyTempo;
  671.  
  672.   if (t == Tree_NoTree) {
  673.     return;
  674.   }
  675.   if (t->U_1.V_1.Kind == Tree_Class) {
  676.     {
  677.       register Tree_yClass *W_5 = &t->U_1.V_5.Class;
  678.  
  679.       INC(ClassCount);
  680.       W_5->Index = ClassCount;
  681.       Relations_MakeRelation(&W_5->SNC, (LONGINT)W_5->InstCount, (LONGINT)W_5->InstCount);
  682.       Relations_Assign(&W_5->SNC, W_5->DP);
  683.       return;
  684.     }
  685.   }
  686. }
  687.  
  688. static void CompIndexToClass
  689. # ifdef __STDC__
  690. (Tree_tTree t)
  691. # else
  692. (t)
  693. Tree_tTree t;
  694. # endif
  695. {
  696.   struct S_5 yyTempo;
  697.  
  698.   if (t == Tree_NoTree) {
  699.     return;
  700.   }
  701.   if (t->U_1.V_1.Kind == Tree_Class) {
  702.     {
  703.       register Tree_yClass *W_6 = &t->U_1.V_5.Class;
  704.  
  705.       Order_IndexToClass->A[W_6->Index] = t;
  706.       Sets_MakeSet(&W_6->Users, (LONGCARD)ClassCount);
  707.       Queue_Enqueue(W_6->Index);
  708.       return;
  709.     }
  710.   }
  711. }
  712.  
  713. static void CompUsers
  714. # ifdef __STDC__
  715. (Tree_tTree t)
  716. # else
  717. (t)
  718. Tree_tTree t;
  719. # endif
  720. {
  721.   struct S_6 yyTempo;
  722.  
  723.   if (t == Tree_NoTree) {
  724.     return;
  725.   }
  726.   if (t->U_1.V_1.Kind == Tree_Class) {
  727.     {
  728.       register Tree_yClass *W_7 = &t->U_1.V_5.Class;
  729.  
  730.       ActClass = t;
  731.       Tree_ForallAttributes(t, (Tree_ProcOfT)CompUsers);
  732.       return;
  733.     }
  734.   }
  735.   if (t->U_1.V_1.Kind == Tree_Child) {
  736.     {
  737.       register Tree_yChild *W_8 = &t->U_1.V_9.Child;
  738.  
  739.       ChildsClass = W_8->Class;
  740.       if (ChildsClass != Tree_NoTree) {
  741.         Sets_Include(&ChildsClass->U_1.V_5.Class.Users, (LONGCARD)ActClass->U_1.V_5.Class.Index);
  742.       }
  743.       return;
  744.     }
  745.   }
  746. }
  747.  
  748. static void CompSNC1
  749. # ifdef __STDC__
  750. (Tree_tTree t)
  751. # else
  752. (t)
  753. Tree_tTree t;
  754. # endif
  755. {
  756.   struct S_7 yyTempo;
  757.  
  758.   if (t == Tree_NoTree) {
  759.     return;
  760.   }
  761.   if (t->U_1.V_1.Kind == Tree_Class) {
  762.     {
  763.       register Tree_yClass *W_9 = &t->U_1.V_5.Class;
  764.  
  765.       {
  766.         SHORTCARD B_11 = 1, B_12 = W_9->AttrCount;
  767.  
  768.         if (B_11 <= B_12)
  769.           for (i = B_11;; i += 1) {
  770.             {
  771.               SHORTCARD B_13 = 1, B_14 = W_9->AttrCount;
  772.  
  773.               if (B_13 <= B_14)
  774.                 for (j = B_13;; j += 1) {
  775.                   if (Relations_IsRelated((LONGINT)i, (LONGINT)j, ActClass->U_1.V_5.Class.SNC)) {
  776.                     if (!Relations_IsRelated((LONGINT)i, (LONGINT)j, W_9->SNC)) {
  777.                       Relations_Include(&W_9->SNC, (LONGINT)i, (LONGINT)j);
  778.                       Queue_Enqueue(W_9->Index);
  779.                     }
  780.                   }
  781.                   if (j >= B_14) break;
  782.                 }
  783.             }
  784.             if (i >= B_12) break;
  785.           }
  786.       }
  787.       return;
  788.     }
  789.   }
  790.   if (t->U_1.V_1.Kind == Tree_Child) {
  791.     for (;;) {
  792.       {
  793.         register Tree_yChild *W_10 = &t->U_1.V_9.Child;
  794.  
  795.         if (!(W_10->Class != Tree_NoTree)) {
  796.           goto EXIT_1;
  797.         }
  798.         ChildsClass = W_10->Class;
  799.         if (!(ChildsClass == ActClass || Queue_IsElement(ChildsClass->U_1.V_5.Class.Index))) {
  800.           goto EXIT_1;
  801.         }
  802.         {
  803.           SHORTCARD B_15 = 1, B_16 = ChildsClass->U_1.V_5.Class.AttrCount;
  804.  
  805.           if (B_15 <= B_16)
  806.             for (i = B_15;; i += 1) {
  807.               {
  808.                 SHORTCARD B_17 = 1, B_18 = ChildsClass->U_1.V_5.Class.AttrCount;
  809.  
  810.                 if (B_17 <= B_18)
  811.                   for (j = B_17;; j += 1) {
  812.                     if (Relations_IsRelated((LONGINT)i, (LONGINT)j, ChildsClass->U_1.V_5.Class.SNC)) {
  813.                       if (!Relations_IsRelated((LONGINT)(UserClass->U_1.V_5.Class.AttrCount + W_10->InstOffset + i), (LONGINT)(UserClass->U_1.V_5.Class.AttrCount + W_10->InstOffset + j), UserClass->U_1.V_5.Class.SNC)) {
  814.                         Relations_Include(&UserClass->U_1.V_5.Class.SNC, (LONGINT)(UserClass->U_1.V_5.Class.AttrCount + W_10->InstOffset + i), (LONGINT)(UserClass->U_1.V_5.Class.AttrCount + W_10->InstOffset + j));
  815.                         Queue_Enqueue(UserClass->U_1.V_5.Class.Index);
  816.                       }
  817.                     }
  818.                     if (j >= B_18) break;
  819.                   }
  820.               }
  821.               if (i >= B_16) break;
  822.             }
  823.         }
  824.         return;
  825.       }
  826.     } EXIT_1:;
  827.   }
  828. }
  829.  
  830. static void CompSNC2
  831. # ifdef __STDC__
  832. (Tree_tTree t)
  833. # else
  834. (t)
  835. Tree_tTree t;
  836. # endif
  837. {
  838.   struct S_8 yyTempo;
  839.  
  840.   if (t == Tree_NoTree) {
  841.     return;
  842.   }
  843.   if (t->U_1.V_1.Kind == Tree_Class) {
  844.     {
  845.       register Tree_yClass *W_11 = &t->U_1.V_5.Class;
  846.  
  847.       if (Relations_HasReflexive(W_11->SNC)) {
  848.         if (!Sets_IsElement(ORD('L'), &Tree_Options)) {
  849.           Tree_WarningI((LONGINT)CycleInSNC, t->U_1.V_5.Class.Pos, (LONGINT)Errors_Ident, ADR(W_11->Name));
  850.           IO_WriteS((System_tFile)IO_StdOutput, (STRING)"Attribute Dependencies SNC", 26L);
  851.           IO_WriteNl((System_tFile)IO_StdOutput);
  852.           IO_WriteNl((System_tFile)IO_StdOutput);
  853.           Tree_WriteDependencies(t, W_11->SNC, Tree_MaxSet);
  854.           IO_WriteS((System_tFile)IO_StdOutput, (STRING)"Cyclic Attributes", 17L);
  855.           IO_WriteNl((System_tFile)IO_StdOutput);
  856.           IO_WriteNl((System_tFile)IO_StdOutput);
  857.           Sets_MakeSet(&Cyclics, (LONGCARD)W_11->InstCount);
  858.           Relations_GetCyclics(W_11->SNC, &Cyclics);
  859.           Tree_WriteCyclics(t, Cyclics);
  860.           IO_WriteNl((System_tFile)IO_StdOutput);
  861.           Sets_ReleaseSet(&Cyclics);
  862.         }
  863.         Sets_Include(&HasCycle, (LONGCARD)W_11->Index);
  864.       }
  865.       if (Sets_IsElement(ORD('S'), &Tree_Options)) {
  866.         Tree_WriteDependencies(t, W_11->SNC, Tree_MaxSet);
  867.       }
  868.       Relations_MakeRelation(&W_11->DNC, (LONGINT)W_11->InstCount, (LONGINT)W_11->InstCount);
  869.       Relations_Assign(&W_11->DNC, W_11->SNC);
  870.       Queue_Enqueue(W_11->Index);
  871.       return;
  872.     }
  873.   }
  874. }
  875.  
  876. static void CompDNC1
  877. # ifdef __STDC__
  878. (Tree_tTree t)
  879. # else
  880. (t)
  881. Tree_tTree t;
  882. # endif
  883. {
  884.   struct S_9 yyTempo;
  885.  
  886.   if (t == Tree_NoTree) {
  887.     return;
  888.   }
  889.   if (t->U_1.V_1.Kind == Tree_Class) {
  890.     {
  891.       register Tree_yClass *W_12 = &t->U_1.V_5.Class;
  892.  
  893.       {
  894.         SHORTCARD B_19 = 1, B_20 = ActClass->U_1.V_5.Class.AttrCount;
  895.  
  896.         if (B_19 <= B_20)
  897.           for (i = B_19;; i += 1) {
  898.             {
  899.               SHORTCARD B_21 = 1, B_22 = ActClass->U_1.V_5.Class.AttrCount;
  900.  
  901.               if (B_21 <= B_22)
  902.                 for (j = B_21;; j += 1) {
  903.                   if (Relations_IsRelated((LONGINT)i, (LONGINT)j, ActClass->U_1.V_5.Class.DNC)) {
  904.                     if (!Relations_IsRelated((LONGINT)i, (LONGINT)j, W_12->DNC)) {
  905.                       Relations_Include(&W_12->DNC, (LONGINT)i, (LONGINT)j);
  906.                       Queue_Enqueue(W_12->Index);
  907.                     }
  908.                   }
  909.                   if (j >= B_22) break;
  910.                 }
  911.             }
  912.             if (i >= B_20) break;
  913.           }
  914.       }
  915.       return;
  916.     }
  917.   }
  918.   if (t->U_1.V_1.Kind == Tree_Child) {
  919.     for (;;) {
  920.       {
  921.         register Tree_yChild *W_13 = &t->U_1.V_9.Child;
  922.  
  923.         if (!(W_13->Class != Tree_NoTree)) {
  924.           goto EXIT_2;
  925.         }
  926.         ChildsClass = W_13->Class;
  927.         {
  928.           SHORTCARD B_23 = 1, B_24 = ChildsClass->U_1.V_5.Class.AttrCount;
  929.  
  930.           if (B_23 <= B_24)
  931.             for (i = B_23;; i += 1) {
  932.               {
  933.                 SHORTCARD B_25 = 1, B_26 = ChildsClass->U_1.V_5.Class.AttrCount;
  934.  
  935.                 if (B_25 <= B_26)
  936.                   for (j = B_25;; j += 1) {
  937.                     if (Relations_IsRelated((LONGINT)(ActClass->U_1.V_5.Class.AttrCount + W_13->InstOffset + i), (LONGINT)(ActClass->U_1.V_5.Class.AttrCount + W_13->InstOffset + j), ActClass->U_1.V_5.Class.DNC)) {
  938.                       if (!Relations_IsRelated((LONGINT)i, (LONGINT)j, ChildsClass->U_1.V_5.Class.DNC)) {
  939.                         Relations_Include(&ChildsClass->U_1.V_5.Class.DNC, (LONGINT)i, (LONGINT)j);
  940.                         Queue_Enqueue(ChildsClass->U_1.V_5.Class.Index);
  941.                       }
  942.                     }
  943.                     if (j >= B_26) break;
  944.                   }
  945.               }
  946.               if (i >= B_24) break;
  947.             }
  948.         }
  949.         return;
  950.       }
  951.     } EXIT_2:;
  952.   }
  953. }
  954.  
  955. static void CompDNC2
  956. # ifdef __STDC__
  957. (Tree_tTree t)
  958. # else
  959. (t)
  960. Tree_tTree t;
  961. # endif
  962. {
  963.   struct S_10 yyTempo;
  964.  
  965.   if (t == Tree_NoTree) {
  966.     return;
  967.   }
  968.   if (t->U_1.V_1.Kind == Tree_Class) {
  969.     {
  970.       register Tree_yClass *W_14 = &t->U_1.V_5.Class;
  971.  
  972.       if (Relations_HasReflexive(W_14->DNC)) {
  973.         if (!Sets_IsElement(ORD('L'), &Tree_Options)) {
  974.           Tree_WarningI((LONGINT)CycleInDNC, t->U_1.V_5.Class.Pos, (LONGINT)Errors_Ident, ADR(W_14->Name));
  975.           IO_WriteS((System_tFile)IO_StdOutput, (STRING)"Attribute Dependencies DNC", 26L);
  976.           IO_WriteNl((System_tFile)IO_StdOutput);
  977.           IO_WriteNl((System_tFile)IO_StdOutput);
  978.           Tree_WriteDependencies(t, W_14->DNC, Tree_MaxSet);
  979.           IO_WriteS((System_tFile)IO_StdOutput, (STRING)"Cyclic Attributes", 17L);
  980.           IO_WriteNl((System_tFile)IO_StdOutput);
  981.           IO_WriteNl((System_tFile)IO_StdOutput);
  982.           Sets_MakeSet(&Cyclics, (LONGCARD)W_14->InstCount);
  983.           Relations_GetCyclics(W_14->DNC, &Cyclics);
  984.           Tree_WriteCyclics(t, Cyclics);
  985.           IO_WriteNl((System_tFile)IO_StdOutput);
  986.           Sets_ReleaseSet(&Cyclics);
  987.         }
  988.         Success = FALSE;
  989.       }
  990.       if (Sets_IsElement(ORD('N'), &Tree_Options)) {
  991.         Tree_WriteDependencies(t, W_14->DNC, Tree_MaxSet);
  992.       }
  993.       Relations_MakeRelation(&W_14->OAG, (LONGINT)W_14->InstCount, (LONGINT)W_14->InstCount);
  994.       Relations_Assign(&W_14->OAG, W_14->DNC);
  995.       return;
  996.     }
  997.   }
  998. }
  999.  
  1000. static void CompOAG0a
  1001. # ifdef __STDC__
  1002. (Tree_tTree t)
  1003. # else
  1004. (t)
  1005. Tree_tTree t;
  1006. # endif
  1007. {
  1008.   struct S_11 yyTempo;
  1009.  
  1010.   if (t == Tree_NoTree) {
  1011.     return;
  1012.   }
  1013.   if (t->U_1.V_1.Kind == Tree_Class) {
  1014.     {
  1015.       register Tree_yClass *W_15 = &t->U_1.V_5.Class;
  1016.  
  1017.       ActClass = t;
  1018.       if (W_15->BaseClass->U_1.V_1.Kind == Tree_Class) {
  1019.         n = W_15->BaseClass->U_1.V_5.Class.AttrCount;
  1020.       } else {
  1021.         n = 0;
  1022.       }
  1023.       k = 0;
  1024.       do {
  1025.         INC(k);
  1026.         do {
  1027.           Stable = TRUE;
  1028.           Kind = Tree_Inherited;
  1029.           Tree_ForallAttributes(W_15->Attributes, (Tree_ProcOfT)CompOAG0a);
  1030.         } while (!Stable);
  1031.         do {
  1032.           Stable = TRUE;
  1033.           Kind = Tree_Synthesized;
  1034.           Tree_ForallAttributes(W_15->Attributes, (Tree_ProcOfT)CompOAG0a);
  1035.         } while (!Stable);
  1036.       } while (!(n == W_15->AttrCount));
  1037.       if (W_15->BaseClass->U_1.V_1.Kind == Tree_Class && W_15->BaseClass->U_1.V_5.Class.Visits > k) {
  1038.         k = W_15->BaseClass->U_1.V_5.Class.Visits;
  1039.       }
  1040.       W_15->Visits = k;
  1041.       if (Tree_MaxVisit < k) {
  1042.         Tree_MaxVisit = k;
  1043.       }
  1044.       return;
  1045.     }
  1046.   }
  1047.   if (t->U_1.V_1.Kind == Tree_Child) {
  1048.     {
  1049.       register Tree_yChild *W_16 = &t->U_1.V_9.Child;
  1050.  
  1051.       if (W_16->Partition == 9999) {
  1052.         if (IN(Tree_Input, W_16->Properties) || (W_16->Properties & (SET_ELEM(Tree_Inherited) | SET_ELEM(Tree_Synthesized))) == 0X0L) {
  1053.           W_16->Partition = 0;
  1054.           INC(n);
  1055.           return;
  1056.         }
  1057.         if (IN(Kind, W_16->Properties)) {
  1058.           {
  1059.             SHORTCARD B_27 = 1, B_28 = ActClass->U_1.V_5.Class.AttrCount;
  1060.  
  1061.             if (B_27 <= B_28)
  1062.               for (i = B_27;; i += 1) {
  1063.                 if (Relations_IsRelated((LONGINT)W_16->AttrIndex, (LONGINT)i, ActClass->U_1.V_5.Class.OAG) && ActClass->U_1.V_5.Class.Instance->A[i - 1].Attribute->U_1.V_9.Child.Partition > k) {
  1064.                   return;
  1065.                 }
  1066.                 if (i >= B_28) break;
  1067.               }
  1068.           }
  1069.           W_16->Partition = k;
  1070.           INC(n);
  1071.           Stable = FALSE;
  1072.         }
  1073.       }
  1074.       return;
  1075.     }
  1076.   }
  1077.   if (t->U_1.V_1.Kind == Tree_Attribute) {
  1078.     {
  1079.       register Tree_yAttribute *W_17 = &t->U_1.V_10.Attribute;
  1080.  
  1081.       if (W_17->Partition == 9999) {
  1082.         if (IN(Tree_Input, W_17->Properties) || (W_17->Properties & (SET_ELEM(Tree_Inherited) | SET_ELEM(Tree_Synthesized))) == 0X0L) {
  1083.           W_17->Partition = 0;
  1084.           INC(n);
  1085.           return;
  1086.         }
  1087.         if (IN(Kind, W_17->Properties)) {
  1088.           {
  1089.             SHORTCARD B_29 = 1, B_30 = ActClass->U_1.V_5.Class.AttrCount;
  1090.  
  1091.             if (B_29 <= B_30)
  1092.               for (i = B_29;; i += 1) {
  1093.                 if (Relations_IsRelated((LONGINT)W_17->AttrIndex, (LONGINT)i, ActClass->U_1.V_5.Class.OAG) && ActClass->U_1.V_5.Class.Instance->A[i - 1].Attribute->U_1.V_10.Attribute.Partition > k) {
  1094.                   return;
  1095.                 }
  1096.                 if (i >= B_30) break;
  1097.               }
  1098.           }
  1099.           W_17->Partition = k;
  1100.           INC(n);
  1101.           Stable = FALSE;
  1102.         }
  1103.       }
  1104.       return;
  1105.     }
  1106.   }
  1107. }
  1108.  
  1109. static void CompOAG0b
  1110. # ifdef __STDC__
  1111. (Tree_tTree t)
  1112. # else
  1113. (t)
  1114. Tree_tTree t;
  1115. # endif
  1116. {
  1117.   struct S_12 yyTempo;
  1118.  
  1119.   if (t == Tree_NoTree) {
  1120.     return;
  1121.   }
  1122.   if (t->U_1.V_1.Kind == Tree_Class) {
  1123.     {
  1124.       register Tree_yClass *W_18 = &t->U_1.V_5.Class;
  1125.  
  1126.       ActClass = t;
  1127.       if (W_18->BaseClass->U_1.V_1.Kind == Tree_Class) {
  1128.         n = W_18->BaseClass->U_1.V_5.Class.AttrCount;
  1129.       } else {
  1130.         n = 0;
  1131.       }
  1132.       k = 0;
  1133.       do {
  1134.         INC(k);
  1135.         do {
  1136.           Kind = Tree_Synthesized;
  1137.           Stable = TRUE;
  1138.           Tree_ForallAttributes(W_18->Attributes, (Tree_ProcOfT)CompOAG0b);
  1139.         } while (!Stable);
  1140.         do {
  1141.           Stable = TRUE;
  1142.           Kind = Tree_Inherited;
  1143.           Tree_ForallAttributes(W_18->Attributes, (Tree_ProcOfT)CompOAG0b);
  1144.         } while (!Stable);
  1145.       } while (!(n == W_18->AttrCount));
  1146.       if (W_18->BaseClass->U_1.V_1.Kind == Tree_Class && W_18->BaseClass->U_1.V_5.Class.Visits > k) {
  1147.         k = W_18->BaseClass->U_1.V_5.Class.Visits;
  1148.       }
  1149.       W_18->Visits = k;
  1150.       if (Tree_MaxVisit < k) {
  1151.         Tree_MaxVisit = k;
  1152.       }
  1153.       return;
  1154.     }
  1155.   }
  1156.   if (t->U_1.V_1.Kind == Tree_Child) {
  1157.     {
  1158.       register Tree_yChild *W_19 = &t->U_1.V_9.Child;
  1159.  
  1160.       if (W_19->Partition == 9999) {
  1161.         if (IN(Tree_Input, W_19->Properties) || (W_19->Properties & (SET_ELEM(Tree_Inherited) | SET_ELEM(Tree_Synthesized))) == 0X0L) {
  1162.           W_19->Partition = 0;
  1163.           INC(n);
  1164.           return;
  1165.         }
  1166.         if (IN(Kind, W_19->Properties)) {
  1167.           {
  1168.             SHORTCARD B_31 = 1, B_32 = ActClass->U_1.V_5.Class.AttrCount;
  1169.  
  1170.             if (B_31 <= B_32)
  1171.               for (i = B_31;; i += 1) {
  1172.                 if (Relations_IsRelated((LONGINT)i, (LONGINT)W_19->AttrIndex, ActClass->U_1.V_5.Class.OAG) && ActClass->U_1.V_5.Class.Instance->A[i - 1].Attribute->U_1.V_9.Child.Partition > k) {
  1173.                   return;
  1174.                 }
  1175.                 if (i >= B_32) break;
  1176.               }
  1177.           }
  1178.           W_19->Partition = k;
  1179.           INC(n);
  1180.           Stable = FALSE;
  1181.         }
  1182.       }
  1183.       return;
  1184.     }
  1185.   }
  1186.   if (t->U_1.V_1.Kind == Tree_Attribute) {
  1187.     {
  1188.       register Tree_yAttribute *W_20 = &t->U_1.V_10.Attribute;
  1189.  
  1190.       if (W_20->Partition == 9999) {
  1191.         if (IN(Tree_Input, W_20->Properties) || (W_20->Properties & (SET_ELEM(Tree_Inherited) | SET_ELEM(Tree_Synthesized))) == 0X0L) {
  1192.           W_20->Partition = 0;
  1193.           INC(n);
  1194.           return;
  1195.         }
  1196.         if (IN(Kind, W_20->Properties)) {
  1197.           {
  1198.             SHORTCARD B_33 = 1, B_34 = ActClass->U_1.V_5.Class.AttrCount;
  1199.  
  1200.             if (B_33 <= B_34)
  1201.               for (i = B_33;; i += 1) {
  1202.                 if (Relations_IsRelated((LONGINT)i, (LONGINT)W_20->AttrIndex, ActClass->U_1.V_5.Class.OAG) && ActClass->U_1.V_5.Class.Instance->A[i - 1].Attribute->U_1.V_10.Attribute.Partition > k) {
  1203.                   return;
  1204.                 }
  1205.                 if (i >= B_34) break;
  1206.               }
  1207.           }
  1208.           W_20->Partition = k;
  1209.           INC(n);
  1210.           Stable = FALSE;
  1211.         }
  1212.       }
  1213.       return;
  1214.     }
  1215.   }
  1216. }
  1217.  
  1218. static void CompOAG0c
  1219. # ifdef __STDC__
  1220. (Tree_tTree t)
  1221. # else
  1222. (t)
  1223. Tree_tTree t;
  1224. # endif
  1225. {
  1226.   struct S_13 yyTempo;
  1227.  
  1228.   if (t == Tree_NoTree) {
  1229.     return;
  1230.   }
  1231.   if (t->U_1.V_1.Kind == Tree_Class) {
  1232.     {
  1233.       register Tree_yClass *W_21 = &t->U_1.V_5.Class;
  1234.  
  1235.       k = W_21->Visits + 1;
  1236.       Tree_ForallAttributes(W_21->Attributes, (Tree_ProcOfT)CompOAG0c);
  1237.       return;
  1238.     }
  1239.   }
  1240.   if (t->U_1.V_1.Kind == Tree_Child) {
  1241.     {
  1242.       register Tree_yChild *W_22 = &t->U_1.V_9.Child;
  1243.  
  1244.       if (W_22->Partition != 0) {
  1245.         W_22->Partition = k - W_22->Partition;
  1246.       }
  1247.       return;
  1248.     }
  1249.   }
  1250.   if (t->U_1.V_1.Kind == Tree_Attribute) {
  1251.     {
  1252.       register Tree_yAttribute *W_23 = &t->U_1.V_10.Attribute;
  1253.  
  1254.       if (W_23->Partition != 0) {
  1255.         W_23->Partition = k - W_23->Partition;
  1256.       }
  1257.       return;
  1258.     }
  1259.   }
  1260. }
  1261.  
  1262. static void CompOAG0d
  1263. # ifdef __STDC__
  1264. (Tree_tTree t)
  1265. # else
  1266. (t)
  1267. Tree_tTree t;
  1268. # endif
  1269. {
  1270.   struct S_14 yyTempo;
  1271.  
  1272.   if (t == Tree_NoTree) {
  1273.     return;
  1274.   }
  1275.   if (t->U_1.V_1.Kind == Tree_Class) {
  1276.     {
  1277.       register Tree_yClass *W_24 = &t->U_1.V_5.Class;
  1278.  
  1279.       ActClass = t;
  1280.       k = 0;
  1281.       do {
  1282.         INC(k);
  1283.         do {
  1284.           Stable = TRUE;
  1285.           Tree_ForallAttributes(W_24->Attributes, (Tree_ProcOfT)CompOAG0d);
  1286.         } while (!Stable);
  1287.         do {
  1288.           Stable = TRUE;
  1289.           Tree_ForallAttributes(W_24->Attributes, (Tree_ProcOfT)CompOAG0e);
  1290.         } while (!Stable);
  1291.       } while (!(k == W_24->Visits));
  1292.       return;
  1293.     }
  1294.   }
  1295.   if (t->U_1.V_1.Kind == Tree_Child) {
  1296.     {
  1297.       register Tree_yChild *W_25 = &t->U_1.V_9.Child;
  1298.  
  1299.       if (W_25->Partition > k && IN(Tree_Synthesized, W_25->Properties) && (((SET_ELEM(Tree_Output) | SET_ELEM(Tree_Test)) & W_25->Properties) != 0X0L || ((SET_ELEM(Tree_Read) | SET_ELEM(Tree_Dummy)) & W_25->Properties) == 0X0L)) {
  1300.         {
  1301.           SHORTCARD B_35 = 1, B_36 = ActClass->U_1.V_5.Class.AttrCount;
  1302.  
  1303.           if (B_35 <= B_36)
  1304.             for (i = B_35;; i += 1) {
  1305.               if (Relations_IsRelated((LONGINT)W_25->AttrIndex, (LONGINT)i, ActClass->U_1.V_5.Class.OAG) && ActClass->U_1.V_5.Class.Instance->A[i - 1].Attribute->U_1.V_9.Child.Partition > k) {
  1306.                 return;
  1307.               }
  1308.               if (i >= B_36) break;
  1309.             }
  1310.         }
  1311.         W_25->Partition = k;
  1312.         Stable = FALSE;
  1313.       }
  1314.       return;
  1315.     }
  1316.   }
  1317.   if (t->U_1.V_1.Kind == Tree_Attribute) {
  1318.     {
  1319.       register Tree_yAttribute *W_26 = &t->U_1.V_10.Attribute;
  1320.  
  1321.       if (W_26->Partition > k && IN(Tree_Synthesized, W_26->Properties) && (((SET_ELEM(Tree_Output) | SET_ELEM(Tree_Test)) & W_26->Properties) != 0X0L || ((SET_ELEM(Tree_Read) | SET_ELEM(Tree_Dummy)) & W_26->Properties) == 0X0L)) {
  1322.         {
  1323.           SHORTCARD B_37 = 1, B_38 = ActClass->U_1.V_5.Class.AttrCount;
  1324.  
  1325.           if (B_37 <= B_38)
  1326.             for (i = B_37;; i += 1) {
  1327.               if (Relations_IsRelated((LONGINT)W_26->AttrIndex, (LONGINT)i, ActClass->U_1.V_5.Class.OAG) && ActClass->U_1.V_5.Class.Instance->A[i - 1].Attribute->U_1.V_10.Attribute.Partition > k) {
  1328.                 return;
  1329.               }
  1330.               if (i >= B_38) break;
  1331.             }
  1332.         }
  1333.         W_26->Partition = k;
  1334.         Stable = FALSE;
  1335.       }
  1336.       return;
  1337.     }
  1338.   }
  1339. }
  1340.  
  1341. static void CompOAG0e
  1342. # ifdef __STDC__
  1343. (Tree_tTree t)
  1344. # else
  1345. (t)
  1346. Tree_tTree t;
  1347. # endif
  1348. {
  1349.   struct S_15 yyTempo;
  1350.  
  1351.   if (t == Tree_NoTree) {
  1352.     return;
  1353.   }
  1354.   if (t->U_1.V_1.Kind == Tree_Child) {
  1355.     {
  1356.       register Tree_yChild *W_27 = &t->U_1.V_9.Child;
  1357.  
  1358.       if (W_27->Partition > k && IN(Tree_Inherited, W_27->Properties) && (((SET_ELEM(Tree_Output) | SET_ELEM(Tree_Test)) & W_27->Properties) != 0X0L || ((SET_ELEM(Tree_Read) | SET_ELEM(Tree_Dummy)) & W_27->Properties) == 0X0L)) {
  1359.         {
  1360.           SHORTCARD B_39 = 1, B_40 = ActClass->U_1.V_5.Class.AttrCount;
  1361.  
  1362.           if (B_39 <= B_40)
  1363.             for (i = B_39;; i += 1) {
  1364.               {
  1365.                 register Tree_tInstance *W_28 = &ActClass->U_1.V_5.Class.Instance->A[i - 1];
  1366.  
  1367.                 if (Relations_IsRelated((LONGINT)W_27->AttrIndex, (LONGINT)i, ActClass->U_1.V_5.Class.OAG) && (IN(Tree_Inherited, W_28->Properties) && W_28->Attribute->U_1.V_9.Child.Partition > k || IN(Tree_Synthesized, W_28->Properties) && W_28->Attribute->U_1.V_9.Child.Partition >= k)) {
  1368.                   return;
  1369.                 }
  1370.               }
  1371.               if (i >= B_40) break;
  1372.             }
  1373.         }
  1374.         W_27->Partition = k;
  1375.         Stable = FALSE;
  1376.       }
  1377.       return;
  1378.     }
  1379.   }
  1380.   if (t->U_1.V_1.Kind == Tree_Attribute) {
  1381.     {
  1382.       register Tree_yAttribute *W_29 = &t->U_1.V_10.Attribute;
  1383.  
  1384.       if (W_29->Partition > k && IN(Tree_Inherited, W_29->Properties) && (((SET_ELEM(Tree_Output) | SET_ELEM(Tree_Test)) & W_29->Properties) != 0X0L || ((SET_ELEM(Tree_Read) | SET_ELEM(Tree_Dummy)) & W_29->Properties) == 0X0L)) {
  1385.         {
  1386.           SHORTCARD B_41 = 1, B_42 = ActClass->U_1.V_5.Class.AttrCount;
  1387.  
  1388.           if (B_41 <= B_42)
  1389.             for (i = B_41;; i += 1) {
  1390.               {
  1391.                 register Tree_tInstance *W_30 = &ActClass->U_1.V_5.Class.Instance->A[i - 1];
  1392.  
  1393.                 if (Relations_IsRelated((LONGINT)W_29->AttrIndex, (LONGINT)i, ActClass->U_1.V_5.Class.OAG) && (IN(Tree_Inherited, W_30->Properties) && W_30->Attribute->U_1.V_10.Attribute.Partition > k || IN(Tree_Synthesized, W_30->Properties) && W_30->Attribute->U_1.V_10.Attribute.Partition >= k)) {
  1394.                   return;
  1395.                 }
  1396.               }
  1397.               if (i >= B_42) break;
  1398.             }
  1399.         }
  1400.         W_29->Partition = k;
  1401.         Stable = FALSE;
  1402.       }
  1403.       return;
  1404.     }
  1405.   }
  1406. }
  1407.  
  1408. static void CompOAG1
  1409. # ifdef __STDC__
  1410. (Tree_tTree t)
  1411. # else
  1412. (t)
  1413. Tree_tTree t;
  1414. # endif
  1415. {
  1416.   struct S_16 yyTempo;
  1417.  
  1418.   if (t == Tree_NoTree) {
  1419.     return;
  1420.   }
  1421.   if (t->U_1.V_1.Kind == Tree_Class) {
  1422.     {
  1423.       register Tree_yClass *W_31 = &t->U_1.V_5.Class;
  1424.  
  1425.       {
  1426.         SHORTCARD B_43 = 1, B_44 = W_31->AttrCount;
  1427.  
  1428.         if (B_43 <= B_44)
  1429.           for (i = B_43;; i += 1) {
  1430.             {
  1431.               register Tree_tInstance *W_32 = &W_31->Instance->A[i - 1];
  1432.  
  1433.               if (IN(Tree_Synthesized, W_32->Properties)) {
  1434.                 {
  1435.                   SHORTCARD B_45 = 1, B_46 = W_31->AttrCount;
  1436.  
  1437.                   if (B_45 <= B_46)
  1438.                     for (j = B_45;; j += 1) {
  1439.                       if (IN(Tree_Inherited, W_31->Instance->A[j - 1].Properties) && W_32->Attribute->U_1.V_9.Child.Partition == W_31->Instance->A[j - 1].Attribute->U_1.V_9.Child.Partition) {
  1440.                         Relations_Include(&W_31->OAG, (LONGINT)i, (LONGINT)j);
  1441.                       }
  1442.                       if (j >= B_46) break;
  1443.                     }
  1444.                 }
  1445.               }
  1446.             }
  1447.             if (i >= B_44) break;
  1448.           }
  1449.       }
  1450.       {
  1451.         SHORTCARD B_47 = 1, B_48 = W_31->AttrCount;
  1452.  
  1453.         if (B_47 <= B_48)
  1454.           for (i = B_47;; i += 1) {
  1455.             {
  1456.               register Tree_tInstance *W_33 = &W_31->Instance->A[i - 1];
  1457.  
  1458.               if (IN(Tree_Inherited, W_33->Properties) && W_33->Attribute->U_1.V_9.Child.Partition >= 2) {
  1459.                 {
  1460.                   SHORTCARD B_49 = 1, B_50 = W_31->AttrCount;
  1461.  
  1462.                   if (B_49 <= B_50)
  1463.                     for (j = B_49;; j += 1) {
  1464.                       if (IN(Tree_Synthesized, W_31->Instance->A[j - 1].Properties) && W_33->Attribute->U_1.V_9.Child.Partition - 1 == W_31->Instance->A[j - 1].Attribute->U_1.V_9.Child.Partition) {
  1465.                         Relations_Include(&W_31->OAG, (LONGINT)i, (LONGINT)j);
  1466.                       }
  1467.                       if (j >= B_50) break;
  1468.                     }
  1469.                 }
  1470.               }
  1471.             }
  1472.             if (i >= B_48) break;
  1473.           }
  1474.       }
  1475.       if (Sets_IsElement(ORD('C'), &Tree_Options)) {
  1476.         Relations_MakeRelation(&W_31->Part, (LONGINT)W_31->InstCount, (LONGINT)W_31->InstCount);
  1477.         Relations_Assign(&W_31->Part, W_31->OAG);
  1478.         Relations_Difference(&W_31->Part, W_31->DNC);
  1479.         Tree_WriteDependencies(t, W_31->Part, Tree_MaxSet);
  1480.         IO_WriteNl((System_tFile)IO_StdOutput);
  1481.         Relations_ReleaseRelation(&W_31->Part);
  1482.       }
  1483.       return;
  1484.     }
  1485.   }
  1486. }
  1487.  
  1488. static void CompOAG2
  1489. # ifdef __STDC__
  1490. (Tree_tTree t)
  1491. # else
  1492. (t)
  1493. Tree_tTree t;
  1494. # endif
  1495. {
  1496.   struct S_17 yyTempo;
  1497.  
  1498.   if (t == Tree_NoTree) {
  1499.     return;
  1500.   }
  1501.   if (t->U_1.V_1.Kind == Tree_Class) {
  1502.     {
  1503.       register Tree_yClass *W_34 = &t->U_1.V_5.Class;
  1504.  
  1505.       ActClass = t;
  1506.       Tree_ForallAttributes(t, (Tree_ProcOfT)CompOAG2);
  1507.       if (Relations_IsCyclic(W_34->OAG)) {
  1508.         if (!Sets_IsElement(ORD('L'), &Tree_Options)) {
  1509.           Tree_WarningI((LONGINT)CycleInOAG, t->U_1.V_5.Class.Pos, (LONGINT)Errors_Ident, ADR(W_34->Name));
  1510.           IO_WriteS((System_tFile)IO_StdOutput, (STRING)"Cyclic Attributes and Artificially Introduced Dependencies", 58L);
  1511.           IO_WriteNl((System_tFile)IO_StdOutput);
  1512.           IO_WriteNl((System_tFile)IO_StdOutput);
  1513.           Relations_MakeRelation(&W_34->Part, (LONGINT)W_34->InstCount, (LONGINT)W_34->InstCount);
  1514.           Sets_MakeSet(&Cyclics, (LONGCARD)W_34->InstCount);
  1515.           Relations_GetCyclics(W_34->OAG, &Cyclics);
  1516.           Relations_Assign(&W_34->Part, W_34->OAG);
  1517.           Relations_Difference(&W_34->Part, W_34->DNC);
  1518.           Tree_WriteDependencies(t, W_34->Part, Cyclics);
  1519.           Relations_ReleaseRelation(&W_34->Part);
  1520.           Sets_ReleaseSet(&Cyclics);
  1521.         }
  1522.         Success = FALSE;
  1523.       }
  1524.       if (Sets_IsElement(ORD('O'), &Tree_Options)) {
  1525.         Tree_WriteDependencies(t, W_34->OAG, Tree_MaxSet);
  1526.       }
  1527.       return;
  1528.     }
  1529.   }
  1530.   if (t->U_1.V_1.Kind == Tree_Child) {
  1531.     for (;;) {
  1532.       {
  1533.         register Tree_yChild *W_35 = &t->U_1.V_9.Child;
  1534.  
  1535.         if (!(W_35->Class != Tree_NoTree)) {
  1536.           goto EXIT_3;
  1537.         }
  1538.         ChildsClass = W_35->Class;
  1539.         {
  1540.           SHORTCARD B_51 = 1, B_52 = ChildsClass->U_1.V_5.Class.AttrCount;
  1541.  
  1542.           if (B_51 <= B_52)
  1543.             for (i = B_51;; i += 1) {
  1544.               {
  1545.                 SHORTCARD B_53 = 1, B_54 = ChildsClass->U_1.V_5.Class.AttrCount;
  1546.  
  1547.                 if (B_53 <= B_54)
  1548.                   for (j = B_53;; j += 1) {
  1549.                     if (Relations_IsRelated((LONGINT)i, (LONGINT)j, ChildsClass->U_1.V_5.Class.OAG)) {
  1550.                       Relations_Include(&ActClass->U_1.V_5.Class.OAG, (LONGINT)(ActClass->U_1.V_5.Class.AttrCount + W_35->InstOffset + i), (LONGINT)(ActClass->U_1.V_5.Class.AttrCount + W_35->InstOffset + j));
  1551.                     }
  1552.                     if (j >= B_54) break;
  1553.                   }
  1554.               }
  1555.               if (i >= B_52) break;
  1556.             }
  1557.         }
  1558.         return;
  1559.       }
  1560.     } EXIT_3:;
  1561.   }
  1562. }
  1563.  
  1564. static void CompOAG3a
  1565. # ifdef __STDC__
  1566. (Tree_tTree t)
  1567. # else
  1568. (t)
  1569. Tree_tTree t;
  1570. # endif
  1571. {
  1572.   struct S_18 yyTempo;
  1573.  
  1574.   if (t == Tree_NoTree) {
  1575.     return;
  1576.   }
  1577.   if (t->U_1.V_1.Kind == Tree_Class) {
  1578.     {
  1579.       register Tree_yClass *W_36 = &t->U_1.V_5.Class;
  1580.  
  1581.       n = 0;
  1582.       Sets_MakeSet(&IsComputed, (LONGCARD)W_36->InstCount);
  1583.       Sets_MakeSet(&IsComputable, (LONGCARD)W_36->InstCount);
  1584.       {
  1585.         SHORTCARD B_55 = 1, B_56 = W_36->InstCount;
  1586.  
  1587.         if (B_55 <= B_56)
  1588.           for (i = B_55;; i += 1) {
  1589.             if (IsComputable3a(i, t)) {
  1590.               Sets_Include(&IsComputable, (LONGCARD)i);
  1591.             }
  1592.             if (i >= B_56) break;
  1593.           }
  1594.       }
  1595.       while (!Sets_IsEmpty(IsComputable)) {
  1596.         i2 = Sets_Minimum(&IsComputable);
  1597.         j = Sets_Maximum(&IsComputable);
  1598.         for (;;) {
  1599.           if (Sets_IsElement((LONGCARD)i2, &IsComputable)) {
  1600.             i = i2;
  1601.             if (!SET_IS_SUBSET1(SET_ELEM(Tree_Inherited) | SET_ELEM(Tree_Left), W_36->Instance->A[i2 - 1].Properties)) {
  1602.               goto EXIT_4;
  1603.             }
  1604.           }
  1605.           INC(i2);
  1606.           if (i2 > j) {
  1607.             goto EXIT_4;
  1608.           }
  1609.         } EXIT_4:;
  1610.         {
  1611.           register Tree_tInstance *W_37 = &W_36->Instance->A[i - 1];
  1612.  
  1613.           INC(n);
  1614.           W_36->Instance->A[n - 1].Order = i;
  1615.           Sets_Include(&IsComputed, (LONGCARD)i);
  1616.           Sets_Exclude(&IsComputable, (LONGCARD)i);
  1617.           INCL(W_37->Properties, Tree_First);
  1618.           Visit = W_37->Attribute->U_1.V_9.Child.Partition;
  1619.           if (SET_IS_SUBSET1(SET_ELEM(Tree_Inherited) | SET_ELEM(Tree_Left), W_37->Properties)) {
  1620.             {
  1621.               SHORTCARD B_57 = 1, B_58 = W_36->AttrCount;
  1622.  
  1623.               if (B_57 <= B_58)
  1624.                 for (i2 = B_57;; i2 += 1) {
  1625.                   {
  1626.                     register Tree_tInstance *W_38 = &W_36->Instance->A[i2 - 1];
  1627.  
  1628.                     if (!Sets_IsElement((LONGCARD)i2, &IsComputed) && IN(Tree_Inherited, W_38->Properties) && W_38->Attribute->U_1.V_9.Child.Partition == Visit) {
  1629.                       INC(n);
  1630.                       W_36->Instance->A[n - 1].Order = i2;
  1631.                       Sets_Include(&IsComputed, (LONGCARD)i2);
  1632.                       Sets_Exclude(&IsComputable, (LONGCARD)i2);
  1633.                     }
  1634.                   }
  1635.                   if (i2 >= B_58) break;
  1636.                 }
  1637.             }
  1638.           } else if (SET_IS_SUBSET1(SET_ELEM(Tree_Synthesized) | SET_ELEM(Tree_Right), W_37->Properties)) {
  1639.             if (W_37->Selector != Tree_NoTree) {
  1640.               ChildsClass = W_37->Selector->U_1.V_9.Child.Class;
  1641.               {
  1642.                 SHORTCARD B_59 = W_36->AttrCount + W_37->Selector->U_1.V_9.Child.InstOffset + 1, B_60 = W_36->AttrCount + W_37->Selector->U_1.V_9.Child.InstOffset + ChildsClass->U_1.V_5.Class.AttrCount;
  1643.  
  1644.                 if (B_59 <= B_60)
  1645.                   for (i2 = B_59;; i2 += 1) {
  1646.                     {
  1647.                       register Tree_tInstance *W_39 = &W_36->Instance->A[i2 - 1];
  1648.  
  1649.                       if (!Sets_IsElement((LONGCARD)i2, &IsComputed) && IN(Tree_Synthesized, W_39->Properties) && W_39->Attribute->U_1.V_9.Child.Partition == Visit) {
  1650.                         INC(n);
  1651.                         W_36->Instance->A[n - 1].Order = i2;
  1652.                         Sets_Include(&IsComputed, (LONGCARD)i2);
  1653.                         Sets_Exclude(&IsComputable, (LONGCARD)i2);
  1654.                       }
  1655.                     }
  1656.                     if (i2 >= B_60) break;
  1657.                   }
  1658.               }
  1659.             }
  1660.           } else {
  1661.             {
  1662.               SHORTCARD B_61 = 1, B_62 = W_36->InstCount;
  1663.  
  1664.               if (B_61 <= B_62)
  1665.                 for (i2 = B_61;; i2 += 1) {
  1666.                   if (!Sets_IsElement((LONGCARD)i2, &IsComputed) && W_36->Instance->A[i2 - 1].Action == W_37->Action) {
  1667.                     INC(n);
  1668.                     W_36->Instance->A[n - 1].Order = i2;
  1669.                     Sets_Include(&IsComputed, (LONGCARD)i2);
  1670.                     Sets_Exclude(&IsComputable, (LONGCARD)i2);
  1671.                   }
  1672.                   if (i2 >= B_62) break;
  1673.                 }
  1674.             }
  1675.           }
  1676.           {
  1677.             SHORTCARD B_63 = 1, B_64 = W_36->InstCount;
  1678.  
  1679.             if (B_63 <= B_64)
  1680.               for (i2 = B_63;; i2 += 1) {
  1681.                 if (!Sets_IsElement((LONGCARD)i2, &IsComputed) && !Sets_IsElement((LONGCARD)i2, &IsComputable) && IsComputable3a(i2, t)) {
  1682.                   Sets_Include(&IsComputable, (LONGCARD)i2);
  1683.                 }
  1684.                 if (i2 >= B_64) break;
  1685.               }
  1686.           }
  1687.         }
  1688.       }
  1689.       if (n != W_36->InstCount) {
  1690.         Tree_ErrorI((LONGINT)InternalErrorCompOAG, t->U_1.V_5.Class.Pos, (LONGINT)Errors_Ident, ADR(W_36->Name));
  1691.         Sets_Exclude(&Tree_Options, ORD('o'));
  1692.       }
  1693.       Sets_ReleaseSet(&IsComputed);
  1694.       Sets_ReleaseSet(&IsComputable);
  1695.       if (Sets_IsElement(ORD('G'), &Tree_Options)) {
  1696.         Order_WriteOrderDecl(t);
  1697.       }
  1698.       if (Sets_IsElement(ORD('E'), &Tree_Options)) {
  1699.         Order_WriteOrderEval(t);
  1700.       }
  1701.       if (Sets_IsElement(ORD('V'), &Tree_Options)) {
  1702.         Order_WriteVisitSequence(t);
  1703.       }
  1704.       return;
  1705.     }
  1706.   }
  1707. }
  1708.  
  1709. static void CompOAG3b
  1710. # ifdef __STDC__
  1711. (Tree_tTree t)
  1712. # else
  1713. (t)
  1714. Tree_tTree t;
  1715. # endif
  1716. {
  1717.   struct S_19 yyTempo;
  1718.  
  1719.   if (t == Tree_NoTree) {
  1720.     return;
  1721.   }
  1722.   if (t->U_1.V_1.Kind == Tree_Class) {
  1723.     {
  1724.       register Tree_yClass *W_40 = &t->U_1.V_5.Class;
  1725.  
  1726.       Sets_MakeSet(&IsComputed, (LONGCARD)W_40->InstCount);
  1727.       n = 0;
  1728.       do {
  1729.         i = W_40->InstCount;
  1730.         for (;;) {
  1731.           {
  1732.             register Tree_tInstance *W_41 = &W_40->Instance->A[i - 1];
  1733.  
  1734.             if (!Sets_IsElement((LONGCARD)i, &IsComputed) && IsComputable3a(i, t)) {
  1735.               INC(n);
  1736.               Sets_Include(&IsComputed, (LONGCARD)i);
  1737.               INCL(W_41->Properties, Tree_First);
  1738.               Visit = W_41->Attribute->U_1.V_9.Child.Partition;
  1739.               if (SET_IS_SUBSET1(SET_ELEM(Tree_Inherited) | SET_ELEM(Tree_Left), W_41->Properties)) {
  1740.                 {
  1741.                   SHORTCARD B_65 = 1, B_66 = W_40->AttrCount;
  1742.  
  1743.                   if (B_65 <= B_66)
  1744.                     for (i2 = B_65;; i2 += 1) {
  1745.                       {
  1746.                         register Tree_tInstance *W_42 = &W_40->Instance->A[i2 - 1];
  1747.  
  1748.                         if (!Sets_IsElement((LONGCARD)i2, &IsComputed) && IN(Tree_Inherited, W_42->Properties) && W_42->Attribute->U_1.V_9.Child.Partition == Visit) {
  1749.                           INC(n);
  1750.                           Sets_Include(&IsComputed, (LONGCARD)i2);
  1751.                           {
  1752.                             SHORTCARD B_67 = 1, B_68 = W_40->InstCount;
  1753.  
  1754.                             if (B_67 <= B_68)
  1755.                               for (j = B_67;; j += 1) {
  1756.                                 if (Relations_IsRelated((LONGINT)j, (LONGINT)i2, W_40->OAG)) {
  1757.                                   Relations_Include(&W_40->OAG, (LONGINT)j, (LONGINT)i);
  1758.                                 }
  1759.                                 if (j >= B_68) break;
  1760.                               }
  1761.                           }
  1762.                         }
  1763.                       }
  1764.                       if (i2 >= B_66) break;
  1765.                     }
  1766.                 }
  1767.               } else if (SET_IS_SUBSET1(SET_ELEM(Tree_Synthesized) | SET_ELEM(Tree_Right), W_41->Properties)) {
  1768.                 if (W_41->Selector != Tree_NoTree) {
  1769.                   ChildsClass = W_41->Selector->U_1.V_9.Child.Class;
  1770.                   {
  1771.                     SHORTCARD B_69 = W_40->AttrCount + W_41->Selector->U_1.V_9.Child.InstOffset + 1, B_70 = W_40->AttrCount + W_41->Selector->U_1.V_9.Child.InstOffset + ChildsClass->U_1.V_5.Class.AttrCount;
  1772.  
  1773.                     if (B_69 <= B_70)
  1774.                       for (i2 = B_69;; i2 += 1) {
  1775.                         {
  1776.                           register Tree_tInstance *W_43 = &W_40->Instance->A[i2 - 1];
  1777.  
  1778.                           if (!Sets_IsElement((LONGCARD)i2, &IsComputed) && IN(Tree_Synthesized, W_43->Properties) && W_43->Attribute->U_1.V_9.Child.Partition == Visit) {
  1779.                             INC(n);
  1780.                             Sets_Include(&IsComputed, (LONGCARD)i2);
  1781.                             {
  1782.                               SHORTCARD B_71 = 1, B_72 = W_40->InstCount;
  1783.  
  1784.                               if (B_71 <= B_72)
  1785.                                 for (j = B_71;; j += 1) {
  1786.                                   if (Relations_IsRelated((LONGINT)j, (LONGINT)i2, W_40->OAG)) {
  1787.                                     Relations_Include(&W_40->OAG, (LONGINT)j, (LONGINT)i);
  1788.                                   }
  1789.                                   if (j >= B_72) break;
  1790.                                 }
  1791.                             }
  1792.                           }
  1793.                         }
  1794.                         if (i2 >= B_70) break;
  1795.                       }
  1796.                   }
  1797.                 }
  1798.               } else {
  1799.                 {
  1800.                   SHORTCARD B_73 = 1, B_74 = W_40->InstCount;
  1801.  
  1802.                   if (B_73 <= B_74)
  1803.                     for (i2 = B_73;; i2 += 1) {
  1804.                       if (!Sets_IsElement((LONGCARD)i2, &IsComputed) && W_40->Instance->A[i2 - 1].Action == W_41->Action) {
  1805.                         INC(n);
  1806.                         Sets_Include(&IsComputed, (LONGCARD)i2);
  1807.                         {
  1808.                           SHORTCARD B_75 = 1, B_76 = W_40->InstCount;
  1809.  
  1810.                           if (B_75 <= B_76)
  1811.                             for (j = B_75;; j += 1) {
  1812.                               if (Relations_IsRelated((LONGINT)j, (LONGINT)i2, W_40->OAG)) {
  1813.                                 Relations_Include(&W_40->OAG, (LONGINT)j, (LONGINT)i);
  1814.                               }
  1815.                               if (j >= B_76) break;
  1816.                             }
  1817.                         }
  1818.                       }
  1819.                       if (i2 >= B_74) break;
  1820.                     }
  1821.                 }
  1822.               }
  1823.               goto EXIT_5;
  1824.             }
  1825.           }
  1826.           DEC(i);
  1827.         } EXIT_5:;
  1828.       } while (!(n == W_40->InstCount));
  1829.       Sets_AssignEmpty(&IsComputed);
  1830.       Sets_MakeSet(&IsComputable, (LONGCARD)W_40->InstCount);
  1831.       {
  1832.         SHORTCARD B_77 = 1, B_78 = W_40->InstCount;
  1833.  
  1834.         if (B_77 <= B_78)
  1835.           for (i = B_77;; i += 1) {
  1836.             if (IsComputable3b(i, t)) {
  1837.               Sets_Include(&IsComputable, (LONGCARD)i);
  1838.             }
  1839.             if (i >= B_78) break;
  1840.           }
  1841.       }
  1842.       while (!Sets_IsEmpty(IsComputable)) {
  1843.         Prio = 0;
  1844.         i2 = Sets_Minimum(&IsComputable);
  1845.         j = Sets_Maximum(&IsComputable);
  1846.         for (;;) {
  1847.           if (Sets_IsElement((LONGCARD)i2, &IsComputable)) {
  1848.             {
  1849.               register Tree_tInstance *W_44 = &W_40->Instance->A[i2 - 1];
  1850.  
  1851.               if ((IN(Tree_Test, W_44->Properties) || !IN(Tree_Read, W_44->Properties)) && Prio < 1) {
  1852.                 i = i2;
  1853.                 Prio = 1;
  1854.               } else if (SET_IS_SUBSET1(SET_ELEM(Tree_Inherited) | SET_ELEM(Tree_Left), W_44->Properties) && Prio < 2) {
  1855.                 i = i2;
  1856.                 Prio = 2;
  1857.               } else if (IN(Tree_Output, W_44->Properties) && Prio < 3) {
  1858.                 i = i2;
  1859.                 Prio = 3;
  1860.               } else {
  1861.                 i = i2;
  1862.                 goto EXIT_6;
  1863.               }
  1864.             }
  1865.           }
  1866.           INC(i2);
  1867.           if (i2 > j) {
  1868.             goto EXIT_6;
  1869.           }
  1870.         } EXIT_6:;
  1871.         {
  1872.           register Tree_tInstance *W_45 = &W_40->Instance->A[i - 1];
  1873.  
  1874.           Sets_Include(&IsComputed, (LONGCARD)i);
  1875.           Visit = W_45->Attribute->U_1.V_9.Child.Partition;
  1876.           if (SET_IS_SUBSET1(SET_ELEM(Tree_Inherited) | SET_ELEM(Tree_Left), W_45->Properties)) {
  1877.             {
  1878.               SHORTCARD B_79 = 1, B_80 = W_40->AttrCount;
  1879.  
  1880.               if (B_79 <= B_80)
  1881.                 for (i2 = B_79;; i2 += 1) {
  1882.                   {
  1883.                     register Tree_tInstance *W_46 = &W_40->Instance->A[i2 - 1];
  1884.  
  1885.                     if (!Sets_IsElement((LONGCARD)i2, &IsComputed) && IN(Tree_Inherited, W_46->Properties) && W_46->Attribute->U_1.V_9.Child.Partition == Visit) {
  1886.                       W_40->Instance->A[n - 1].Order = i2;
  1887.                       DEC(n);
  1888.                       Sets_Include(&IsComputed, (LONGCARD)i2);
  1889.                     }
  1890.                   }
  1891.                   if (i2 >= B_80) break;
  1892.                 }
  1893.             }
  1894.           } else if (SET_IS_SUBSET1(SET_ELEM(Tree_Synthesized) | SET_ELEM(Tree_Right), W_45->Properties)) {
  1895.             if (W_45->Selector != Tree_NoTree) {
  1896.               ChildsClass = W_45->Selector->U_1.V_9.Child.Class;
  1897.               {
  1898.                 SHORTCARD B_81 = W_40->AttrCount + W_45->Selector->U_1.V_9.Child.InstOffset + 1, B_82 = W_40->AttrCount + W_45->Selector->U_1.V_9.Child.InstOffset + ChildsClass->U_1.V_5.Class.AttrCount;
  1899.  
  1900.                 if (B_81 <= B_82)
  1901.                   for (i2 = B_81;; i2 += 1) {
  1902.                     {
  1903.                       register Tree_tInstance *W_47 = &W_40->Instance->A[i2 - 1];
  1904.  
  1905.                       if (!Sets_IsElement((LONGCARD)i2, &IsComputed) && IN(Tree_Synthesized, W_47->Properties) && W_47->Attribute->U_1.V_9.Child.Partition == Visit) {
  1906.                         W_40->Instance->A[n - 1].Order = i2;
  1907.                         DEC(n);
  1908.                         Sets_Include(&IsComputed, (LONGCARD)i2);
  1909.                       }
  1910.                     }
  1911.                     if (i2 >= B_82) break;
  1912.                   }
  1913.               }
  1914.             }
  1915.           } else {
  1916.             {
  1917.               SHORTCARD B_83 = 1, B_84 = W_40->InstCount;
  1918.  
  1919.               if (B_83 <= B_84)
  1920.                 for (i2 = B_83;; i2 += 1) {
  1921.                   if (!Sets_IsElement((LONGCARD)i2, &IsComputed) && W_40->Instance->A[i2 - 1].Action == W_45->Action) {
  1922.                     W_40->Instance->A[n - 1].Order = i2;
  1923.                     DEC(n);
  1924.                     Sets_Include(&IsComputed, (LONGCARD)i2);
  1925.                   }
  1926.                   if (i2 >= B_84) break;
  1927.                 }
  1928.             }
  1929.           }
  1930.           W_40->Instance->A[n - 1].Order = i;
  1931.           DEC(n);
  1932.           Sets_Exclude(&IsComputable, (LONGCARD)i);
  1933.           {
  1934.             SHORTCARD B_85 = 1, B_86 = W_40->InstCount;
  1935.  
  1936.             if (B_85 <= B_86)
  1937.               for (i2 = B_85;; i2 += 1) {
  1938.                 if (IN(Tree_First, W_40->Instance->A[i2 - 1].Properties) && !Sets_IsElement((LONGCARD)i2, &IsComputed) && !Sets_IsElement((LONGCARD)i2, &IsComputable) && IsComputable3b(i2, t)) {
  1939.                   Sets_Include(&IsComputable, (LONGCARD)i2);
  1940.                 }
  1941.                 if (i2 >= B_86) break;
  1942.               }
  1943.           }
  1944.         }
  1945.       }
  1946.       Sets_ReleaseSet(&IsComputed);
  1947.       Sets_ReleaseSet(&IsComputable);
  1948.       if (n != 0) {
  1949.         CompOAG3a(t);
  1950.       } else {
  1951.         if (Sets_IsElement(ORD('G'), &Tree_Options)) {
  1952.           Order_WriteOrderDecl(t);
  1953.         }
  1954.         if (Sets_IsElement(ORD('E'), &Tree_Options)) {
  1955.           Order_WriteOrderEval(t);
  1956.         }
  1957.         if (Sets_IsElement(ORD('V'), &Tree_Options)) {
  1958.           Order_WriteVisitSequence(t);
  1959.         }
  1960.       }
  1961.       return;
  1962.     }
  1963.   }
  1964. }
  1965.  
  1966. void Order_WriteOrderDecl
  1967. # ifdef __STDC__
  1968. (Tree_tTree t)
  1969. # else
  1970. (t)
  1971. Tree_tTree t;
  1972. # endif
  1973. {
  1974.   struct S_20 yyTempo;
  1975.  
  1976.   if (t == Tree_NoTree) {
  1977.     return;
  1978.   }
  1979.   if (t->U_1.V_1.Kind == Tree_Class) {
  1980.     {
  1981.       register Tree_yClass *W_48 = &t->U_1.V_5.Class;
  1982.  
  1983.       Idents_WriteIdent((System_tFile)IO_StdOutput, W_48->Name);
  1984.       IO_WriteS((System_tFile)IO_StdOutput, (STRING)"    ", 1L);
  1985.       Tree_WriteClassProperties((System_tFile)IO_StdOutput, W_48->Properties);
  1986.       IO_WriteNl((System_tFile)IO_StdOutput);
  1987.       IO_WriteNl((System_tFile)IO_StdOutput);
  1988.       {
  1989.         SHORTCARD B_87 = 1, B_88 = W_48->InstCount;
  1990.  
  1991.         if (B_87 <= B_88)
  1992.           for (i = B_87;; i += 1) {
  1993.             IO_WriteI((System_tFile)IO_StdOutput, (LONGINT)i, 2L);
  1994.             Tree_WriteInstance(W_48->Instance->A[i - 1]);
  1995.             if (i >= B_88) break;
  1996.           }
  1997.       }
  1998.       IO_WriteNl((System_tFile)IO_StdOutput);
  1999.       return;
  2000.     }
  2001.   }
  2002. }
  2003.  
  2004. void Order_WriteOrderEval
  2005. # ifdef __STDC__
  2006. (Tree_tTree t)
  2007. # else
  2008. (t)
  2009. Tree_tTree t;
  2010. # endif
  2011. {
  2012.   struct S_21 yyTempo;
  2013.  
  2014.   if (t == Tree_NoTree) {
  2015.     return;
  2016.   }
  2017.   if (t->U_1.V_1.Kind == Tree_Class) {
  2018.     {
  2019.       register Tree_yClass *W_49 = &t->U_1.V_5.Class;
  2020.  
  2021.       Idents_WriteIdent((System_tFile)IO_StdOutput, W_49->Name);
  2022.       IO_WriteS((System_tFile)IO_StdOutput, (STRING)"    ", 1L);
  2023.       Tree_WriteClassProperties((System_tFile)IO_StdOutput, W_49->Properties);
  2024.       IO_WriteNl((System_tFile)IO_StdOutput);
  2025.       IO_WriteNl((System_tFile)IO_StdOutput);
  2026.       {
  2027.         SHORTCARD B_89 = 1, B_90 = W_49->InstCount;
  2028.  
  2029.         if (B_89 <= B_90)
  2030.           for (i = B_89;; i += 1) {
  2031.             IO_WriteI((System_tFile)IO_StdOutput, (LONGINT)W_49->Instance->A[i - 1].Order, 2L);
  2032.             Tree_WriteInstance(W_49->Instance->A[W_49->Instance->A[i - 1].Order - 1]);
  2033.             if (i >= B_90) break;
  2034.           }
  2035.       }
  2036.       IO_WriteNl((System_tFile)IO_StdOutput);
  2037.       return;
  2038.     }
  2039.   }
  2040. }
  2041.  
  2042. void Order_WriteVisitSequence
  2043. # ifdef __STDC__
  2044. (Tree_tTree t)
  2045. # else
  2046. (t)
  2047. Tree_tTree t;
  2048. # endif
  2049. {
  2050.   struct S_22 yyTempo;
  2051.  
  2052.   if (t == Tree_NoTree) {
  2053.     return;
  2054.   }
  2055.   if (t->U_1.V_1.Kind == Tree_Class) {
  2056.     {
  2057.       register Tree_yClass *W_50 = &t->U_1.V_5.Class;
  2058.  
  2059.       Idents_WriteIdent((System_tFile)IO_StdOutput, W_50->Name);
  2060.       IO_WriteS((System_tFile)IO_StdOutput, (STRING)"    ", 1L);
  2061.       Tree_WriteClassProperties((System_tFile)IO_StdOutput, W_50->Properties);
  2062.       IO_WriteNl((System_tFile)IO_StdOutput);
  2063.       IO_WriteNl((System_tFile)IO_StdOutput);
  2064.       {
  2065.         SHORTCARD B_91 = 1, B_92 = W_50->InstCount;
  2066.  
  2067.         if (B_91 <= B_92)
  2068.           for (i = B_91;; i += 1) {
  2069.             AttrInstance = W_50->Instance->A[W_50->Instance->A[i - 1].Order - 1];
  2070.             {
  2071.               register Tree_tInstance *W_51 = &AttrInstance;
  2072.  
  2073.               if (IN(Tree_Inherited, W_51->Properties)) {
  2074.                 if (IN(Tree_Left, W_51->Properties)) {
  2075.                   if (IN(Tree_First, W_51->Properties)) {
  2076.                     IO_WriteS((System_tFile)IO_StdOutput, (STRING)"visit    parent ", 13L);
  2077.                     IO_WriteI((System_tFile)IO_StdOutput, (LONGINT)W_51->Attribute->U_1.V_9.Child.Partition, 0L);
  2078.                     IO_WriteS((System_tFile)IO_StdOutput, (STRING)". time to compute", 17L);
  2079.                     IO_WriteNl((System_tFile)IO_StdOutput);
  2080.                   }
  2081.                   IO_WriteS((System_tFile)IO_StdOutput, (STRING)"    ", 1L);
  2082.                   Tree_WriteName(AttrInstance);
  2083.                   IO_WriteNl((System_tFile)IO_StdOutput);
  2084.                 }
  2085.                 if (IN(Tree_Right, W_51->Properties)) {
  2086.                   if (IN(Tree_First, W_51->Properties)) {
  2087.                     IO_WriteS((System_tFile)IO_StdOutput, (STRING)"compute    ", 8L);
  2088.                   } else {
  2089.                     IO_WriteS((System_tFile)IO_StdOutput, (STRING)"    ", 1L);
  2090.                   }
  2091.                   Tree_WriteName(AttrInstance);
  2092.                   IO_WriteNl((System_tFile)IO_StdOutput);
  2093.                 }
  2094.               }
  2095.               if (IN(Tree_Synthesized, W_51->Properties)) {
  2096.                 if (IN(Tree_Left, W_51->Properties) && !IN(Tree_Dummy, W_51->Properties)) {
  2097.                   if (IN(Tree_Test, W_51->Properties)) {
  2098.                     IO_WriteS((System_tFile)IO_StdOutput, (STRING)"check    condition ", 16L);
  2099.                   } else if (IN(Tree_First, W_51->Properties)) {
  2100.                     IO_WriteS((System_tFile)IO_StdOutput, (STRING)"compute    ", 8L);
  2101.                   } else {
  2102.                     IO_WriteS((System_tFile)IO_StdOutput, (STRING)"    ", 1L);
  2103.                   }
  2104.                   Idents_WriteIdent((System_tFile)IO_StdOutput, W_51->Attribute->U_1.V_9.Child.Name);
  2105.                   IO_WriteNl((System_tFile)IO_StdOutput);
  2106.                 }
  2107.                 if (IN(Tree_Right, W_51->Properties)) {
  2108.                   if (SET_IS_SUBSET1(SET_ELEM(Tree_First) | SET_ELEM(Tree_Dummy), W_51->Properties)) {
  2109.                     IO_WriteS((System_tFile)IO_StdOutput, (STRING)"visit    ", 6L);
  2110.                     Idents_WriteIdent((System_tFile)IO_StdOutput, W_51->Selector->U_1.V_9.Child.Name);
  2111.                     IO_WriteI((System_tFile)IO_StdOutput, (LONGINT)W_51->Attribute->U_1.V_9.Child.Partition, 2L);
  2112.                     IO_WriteS((System_tFile)IO_StdOutput, (STRING)". time", 6L);
  2113.                     IO_WriteNl((System_tFile)IO_StdOutput);
  2114.                   }
  2115.                   if (!IN(Tree_Dummy, W_51->Properties)) {
  2116.                     if (IN(Tree_First, W_51->Properties)) {
  2117.                       IO_WriteS((System_tFile)IO_StdOutput, (STRING)"visit    ", 6L);
  2118.                       Idents_WriteIdent((System_tFile)IO_StdOutput, W_51->Selector->U_1.V_9.Child.Name);
  2119.                       IO_WriteI((System_tFile)IO_StdOutput, (LONGINT)W_51->Attribute->U_1.V_9.Child.Partition, 2L);
  2120.                       IO_WriteS((System_tFile)IO_StdOutput, (STRING)". time to compute", 17L);
  2121.                       IO_WriteNl((System_tFile)IO_StdOutput);
  2122.                     }
  2123.                     IO_WriteS((System_tFile)IO_StdOutput, (STRING)"    ", 1L);
  2124.                     Tree_WriteName(AttrInstance);
  2125.                     IO_WriteNl((System_tFile)IO_StdOutput);
  2126.                   }
  2127.                 }
  2128.               }
  2129.             }
  2130.             if (i >= B_92) break;
  2131.           }
  2132.       }
  2133.       IO_WriteS((System_tFile)IO_StdOutput, (STRING)"visit    parent", 12L);
  2134.       IO_WriteNl((System_tFile)IO_StdOutput);
  2135.       IO_WriteNl((System_tFile)IO_StdOutput);
  2136.       return;
  2137.     }
  2138.   }
  2139. }
  2140.  
  2141. static void CheckNormalForm
  2142. # ifdef __STDC__
  2143. (Tree_tTree t)
  2144. # else
  2145. (t)
  2146. Tree_tTree t;
  2147. # endif
  2148. {
  2149.   struct S_23 yyTempo;
  2150.  
  2151.   if (t == Tree_NoTree) {
  2152.     return;
  2153.   }
  2154.   if (t->U_1.V_1.Kind == Tree_Class) {
  2155.     {
  2156.       register Tree_yClass *W_52 = &t->U_1.V_5.Class;
  2157.  
  2158.       {
  2159.         SHORTCARD B_93 = 1, B_94 = W_52->InstCount;
  2160.  
  2161.         if (B_93 <= B_94)
  2162.           for (i = B_93;; i += 1) {
  2163.             if (!IN(Tree_Dummy, W_52->Instance->A[i - 1].Properties)) {
  2164.               {
  2165.                 SHORTCARD B_95 = 1, B_96 = W_52->InstCount;
  2166.  
  2167.                 if (B_95 <= B_96)
  2168.                   for (j = B_95;; j += 1) {
  2169.                     if (Relations_IsRelated((LONGINT)i, (LONGINT)j, W_52->DP)) {
  2170.                       {
  2171.                         register Tree_tInstance *W_53 = &W_52->Instance->A[j - 1];
  2172.  
  2173.                         if (SET_IS_SUBSET1(SET_ELEM(Tree_Left) | SET_ELEM(Tree_Synthesized), W_53->Properties) || SET_IS_SUBSET1(SET_ELEM(Tree_Right) | SET_ELEM(Tree_Inherited), W_53->Properties)) {
  2174.                           Success = FALSE;
  2175.                           return;
  2176.                         }
  2177.                       }
  2178.                     }
  2179.                     if (j >= B_96) break;
  2180.                   }
  2181.               }
  2182.             }
  2183.             if (i >= B_94) break;
  2184.           }
  2185.       }
  2186.       return;
  2187.     }
  2188.   }
  2189. }
  2190.  
  2191. static void CheckLAG
  2192. # ifdef __STDC__
  2193. (Tree_tTree t)
  2194. # else
  2195. (t)
  2196. Tree_tTree t;
  2197. # endif
  2198. {
  2199.   struct S_24 yyTempo;
  2200.  
  2201.   if (t == Tree_NoTree) {
  2202.     return;
  2203.   }
  2204.   if (t->U_1.V_1.Kind == Tree_Class) {
  2205.     {
  2206.       register Tree_yClass *W_54 = &t->U_1.V_5.Class;
  2207.  
  2208.       {
  2209.         SHORTCARD B_97 = W_54->AttrCount + 1, B_98 = W_54->InstCount;
  2210.  
  2211.         if (B_97 <= B_98)
  2212.           for (i = B_97;; i += 1) {
  2213.             {
  2214.               SHORTCARD B_99 = 1, B_100 = W_54->AttrCount;
  2215.  
  2216.               if (B_99 <= B_100)
  2217.                 for (j = B_99;; j += 1) {
  2218.                   if (IN(Tree_Synthesized, W_54->Instance->A[j - 1].Properties) && Relations_IsRelated((LONGINT)i, (LONGINT)j, W_54->DP)) {
  2219.                     Success = FALSE;
  2220.                     return;
  2221.                   }
  2222.                   if (j >= B_100) break;
  2223.                 }
  2224.             }
  2225.             {
  2226.               register Tree_tInstance *W_55 = &W_54->Instance->A[i - 1];
  2227.  
  2228.               if (W_55->Selector != Tree_NoTree) {
  2229.                 ChildsClass = W_55->Selector->U_1.V_9.Child.Class;
  2230.                 {
  2231.                   SHORTCARD B_101 = W_54->AttrCount + W_55->Selector->U_1.V_9.Child.InstOffset + 1, B_102 = W_54->AttrCount + W_55->Selector->U_1.V_9.Child.InstOffset + ChildsClass->U_1.V_5.Class.AttrCount;
  2232.  
  2233.                   if (B_101 <= B_102)
  2234.                     for (j = B_101;; j += 1) {
  2235.                       if (IN(Tree_Synthesized, W_54->Instance->A[j - 1].Properties) && Relations_IsRelated((LONGINT)i, (LONGINT)j, W_54->DP)) {
  2236.                         Success = FALSE;
  2237.                         return;
  2238.                       }
  2239.                       if (j >= B_102) break;
  2240.                     }
  2241.                 }
  2242.                 {
  2243.                   SHORTCARD B_103 = W_54->AttrCount + W_55->Selector->U_1.V_9.Child.InstOffset + ChildsClass->U_1.V_5.Class.AttrCount + 1, B_104 = W_54->InstCount;
  2244.  
  2245.                   if (B_103 <= B_104)
  2246.                     for (j = B_103;; j += 1) {
  2247.                       if (Relations_IsRelated((LONGINT)i, (LONGINT)j, W_54->DP)) {
  2248.                         Success = FALSE;
  2249.                         return;
  2250.                       }
  2251.                       if (j >= B_104) break;
  2252.                     }
  2253.                 }
  2254.               }
  2255.             }
  2256.             if (i >= B_98) break;
  2257.           }
  2258.       }
  2259.       return;
  2260.     }
  2261.   }
  2262. }
  2263.  
  2264. static void CheckSAG
  2265. # ifdef __STDC__
  2266. (Tree_tTree t)
  2267. # else
  2268. (t)
  2269. Tree_tTree t;
  2270. # endif
  2271. {
  2272.   struct S_25 yyTempo;
  2273.  
  2274.   if (t == Tree_NoTree) {
  2275.     return;
  2276.   }
  2277.   if (t->U_1.V_1.Kind == Tree_Class) {
  2278.     {
  2279.       register Tree_yClass *W_56 = &t->U_1.V_5.Class;
  2280.  
  2281.       {
  2282.         SHORTCARD B_105 = W_56->AttrCount + 1, B_106 = W_56->InstCount;
  2283.  
  2284.         if (B_105 <= B_106)
  2285.           for (i = B_105;; i += 1) {
  2286.             {
  2287.               SHORTCARD B_107 = 1, B_108 = W_56->InstCount;
  2288.  
  2289.               if (B_107 <= B_108)
  2290.                 for (j = B_107;; j += 1) {
  2291.                   if (Relations_IsRelated((LONGINT)i, (LONGINT)j, W_56->DP)) {
  2292.                     Success = FALSE;
  2293.                     return;
  2294.                   }
  2295.                   if (j >= B_108) break;
  2296.                 }
  2297.             }
  2298.             if (i >= B_106) break;
  2299.           }
  2300.       }
  2301.       return;
  2302.     }
  2303.   }
  2304. }
  2305.  
  2306. static void InitWAG
  2307. # ifdef __STDC__
  2308. (Tree_tTree t)
  2309. # else
  2310. (t)
  2311. Tree_tTree t;
  2312. # endif
  2313. {
  2314.   struct S_26 yyTempo;
  2315.  
  2316.   if (t == Tree_NoTree) {
  2317.     return;
  2318.   }
  2319.   if (t->U_1.V_1.Kind == Tree_Class) {
  2320.     for (;;) {
  2321.       {
  2322.         register Tree_yClass *W_57 = &t->U_1.V_5.Class;
  2323.  
  2324.         if (!!Sets_IsElement((LONGCARD)W_57->Index, &Relevant)) {
  2325.           goto EXIT_7;
  2326.         }
  2327.         Sets_Include(&Relevant, (LONGCARD)W_57->Index);
  2328.         Tree_ForallAttributes(t, (Tree_ProcOfT)InitWAG);
  2329.         Tree_ForallClasses(W_57->Extensions, (Tree_ProcOfT)InitWAG);
  2330.         return;
  2331.       }
  2332.     } EXIT_7:;
  2333.   }
  2334.   if (t->U_1.V_1.Kind == Tree_Child) {
  2335.     {
  2336.       register Tree_yChild *W_58 = &t->U_1.V_9.Child;
  2337.  
  2338.       InitWAG(W_58->Class);
  2339.       return;
  2340.     }
  2341.   }
  2342. }
  2343.  
  2344. static void CheckWAG0
  2345. # ifdef __STDC__
  2346. (Tree_tTree t)
  2347. # else
  2348. (t)
  2349. Tree_tTree t;
  2350. # endif
  2351. {
  2352.   struct S_27 yyTempo;
  2353.  
  2354.   if (t == Tree_NoTree) {
  2355.     return;
  2356.   }
  2357.   if (t->U_1.V_1.Kind == Tree_Class) {
  2358.     {
  2359.       register Tree_yClass *W_59 = &t->U_1.V_5.Class;
  2360.  
  2361.       Tree_ForallAttributes(t, (Tree_ProcOfT)CheckWAG0);
  2362.       return;
  2363.     }
  2364.   }
  2365.   if (t->U_1.V_1.Kind == Tree_Child) {
  2366.     {
  2367.       register Tree_yChild *W_60 = &t->U_1.V_9.Child;
  2368.  
  2369.       CheckWAG1(W_60->Class);
  2370.       return;
  2371.     }
  2372.   }
  2373. }
  2374.  
  2375. static void CheckWAG1
  2376. # ifdef __STDC__
  2377. (Tree_tTree t)
  2378. # else
  2379. (t)
  2380. Tree_tTree t;
  2381. # endif
  2382. {
  2383.   struct S_28 yyTempo;
  2384.  
  2385.   if (t == Tree_NoTree) {
  2386.     return;
  2387.   }
  2388.   {
  2389.     register struct S_29 *W_61 = &yyTempo.U_1.V_1.yyR1;
  2390.  
  2391.     for (;;) {
  2392.       {
  2393.         register Tree_yClass *W_62 = &t->U_1.V_5.Class;
  2394.  
  2395.         if (!!Sets_IsElement((LONGCARD)W_62->Index, &Cyclics)) {
  2396.           goto EXIT_8;
  2397.         }
  2398.         Sets_Include(&Cyclics, (LONGCARD)W_62->Index);
  2399.         Relations_ReleaseRelation(&W_62->DNC);
  2400.         Relations_MakeRelation(&W_61->C_0_A, (LONGINT)W_62->InstCount, (LONGINT)W_62->InstCount);
  2401.         Relations_Assign(&W_61->C_0_A, W_62->DP);
  2402.         W_62->D = NIL;
  2403.         CheckWAG5(t, W_61->C_0_A);
  2404.         Relations_ReleaseRelation(&W_61->C_0_A);
  2405.         CheckWAG0(t);
  2406.         Tree_ForallClasses(W_62->Extensions, (Tree_ProcOfT)CheckWAG1);
  2407.         return;
  2408.       }
  2409.     } EXIT_8:;
  2410.   }
  2411. }
  2412.  
  2413. static void CheckWAG2
  2414. # ifdef __STDC__
  2415. (Tree_tTree t)
  2416. # else
  2417. (t)
  2418. Tree_tTree t;
  2419. # endif
  2420. {
  2421.   struct S_30 yyTempo;
  2422.  
  2423.   if (t == Tree_NoTree) {
  2424.     return;
  2425.   }
  2426.   {
  2427.     register struct S_31 *W_63 = &yyTempo.U_1.V_1.yyR1;
  2428.  
  2429.     {
  2430.       register Tree_yClass *W_64 = &t->U_1.V_5.Class;
  2431.  
  2432.       Relations_MakeRelation(&W_63->C_0_A, (LONGINT)W_64->InstCount, (LONGINT)W_64->InstCount);
  2433.       Relations_Assign(&W_63->C_0_A, W_64->DP);
  2434.       ActClass = t;
  2435.       CheckWAG3(W_64->Attributes, W_63->C_0_A);
  2436.       Relations_ReleaseRelation(&W_63->C_0_A);
  2437.       return;
  2438.     }
  2439.   }
  2440. }
  2441.  
  2442. static void CheckWAG3
  2443. # ifdef __STDC__
  2444. (Tree_tTree yyP2, Relations_tRelation yyP1)
  2445. # else
  2446. (yyP2, yyP1)
  2447. Tree_tTree yyP2;
  2448. Relations_tRelation yyP1;
  2449. # endif
  2450. {
  2451.   struct S_32 yyTempo;
  2452.  
  2453.   if (yyP2 == Tree_NoTree) {
  2454.     return;
  2455.   }
  2456.   if (yyP2->U_1.V_1.Kind == Tree_Child) {
  2457.     {
  2458.       register Tree_yChild *W_65 = &yyP2->U_1.V_9.Child;
  2459.  
  2460.       CheckWAG4(W_65->Class, yyP1, W_65->Next, yyP2);
  2461.       return;
  2462.     }
  2463.   }
  2464.   if (yyP2->U_1.V_1.Kind == Tree_NoAttribute) {
  2465.     {
  2466.       register Tree_yNoAttribute *W_66 = &yyP2->U_1.V_7.NoAttribute;
  2467.  
  2468.       CheckWAG5(ActClass, yyP1);
  2469.       return;
  2470.     }
  2471.   }
  2472.   if (yyP2->U_1.V_1.Kind == Tree_Attribute) {
  2473.     {
  2474.       register Tree_yAttribute *W_67 = &yyP2->U_1.V_10.Attribute;
  2475.  
  2476.       CheckWAG3(W_67->Next, yyP1);
  2477.       return;
  2478.     }
  2479.   }
  2480.   if (yyP2->U_1.V_1.Kind == Tree_ActionPart) {
  2481.     {
  2482.       register Tree_yActionPart *W_68 = &yyP2->U_1.V_11.ActionPart;
  2483.  
  2484.       CheckWAG3(W_68->Next, yyP1);
  2485.       return;
  2486.     }
  2487.   }
  2488. }
  2489.  
  2490. static void CheckWAG4
  2491. # ifdef __STDC__
  2492. (Tree_tTree yyP6, Relations_tRelation yyP5, Tree_tTree yyP4, Tree_tTree yyP3)
  2493. # else
  2494. (yyP6, yyP5, yyP4, yyP3)
  2495. Tree_tTree yyP6;
  2496. Relations_tRelation yyP5;
  2497. Tree_tTree yyP4;
  2498. Tree_tTree yyP3;
  2499. # endif
  2500. {
  2501.   struct S_33 yyTempo;
  2502.  
  2503.   if (yyP6 == Tree_NoTree) {
  2504.     return;
  2505.   }
  2506.   if (yyP4 == Tree_NoTree) {
  2507.     return;
  2508.   }
  2509.   if (yyP3 == Tree_NoTree) {
  2510.     return;
  2511.   }
  2512.   {
  2513.     register struct S_34 *W_69 = &yyTempo.U_1.V_1.yyR1;
  2514.  
  2515.     {
  2516.       register Tree_yClass *W_70 = &yyP6->U_1.V_5.Class;
  2517.  
  2518.       Relations_MakeRelation(&W_69->B, (LONGINT)ActClass->U_1.V_5.Class.InstCount, (LONGINT)ActClass->U_1.V_5.Class.InstCount);
  2519.       W_69->ActD = W_70->D;
  2520.       while (W_69->ActD != NIL) {
  2521.         Relations_Assign(&W_69->B, yyP5);
  2522.         {
  2523.           SHORTCARD B_109 = 2, B_110 = yyP3->U_1.V_9.Child.Class->U_1.V_5.Class.AttrCount;
  2524.  
  2525.           if (B_109 <= B_110)
  2526.             for (i = B_109;; i += 1) {
  2527.               {
  2528.                 SHORTCARD B_111 = 2, B_112 = yyP3->U_1.V_9.Child.Class->U_1.V_5.Class.AttrCount;
  2529.  
  2530.                 if (B_111 <= B_112)
  2531.                   for (j = B_111;; j += 1) {
  2532.                     if (Relations_IsRelated((LONGINT)i, (LONGINT)j, W_69->ActD->Relation)) {
  2533.                       Relations_Include(&W_69->B, (LONGINT)(ActClass->U_1.V_5.Class.AttrCount + yyP3->U_1.V_9.Child.InstOffset + i), (LONGINT)(ActClass->U_1.V_5.Class.AttrCount + yyP3->U_1.V_9.Child.InstOffset + j));
  2534.                     }
  2535.                     if (j >= B_112) break;
  2536.                   }
  2537.               }
  2538.               if (i >= B_110) break;
  2539.             }
  2540.         }
  2541.         CheckWAG3(yyP4, W_69->B);
  2542.         W_69->ActD = W_69->ActD->Next;
  2543.       }
  2544.       Relations_ReleaseRelation(&W_69->B);
  2545.       return;
  2546.     }
  2547.   }
  2548. }
  2549.  
  2550. static void CheckWAG5
  2551. # ifdef __STDC__
  2552. (Tree_tTree t, Relations_tRelation yyP7)
  2553. # else
  2554. (t, yyP7)
  2555. Tree_tTree t;
  2556. Relations_tRelation yyP7;
  2557. # endif
  2558. {
  2559.   struct S_35 yyTempo;
  2560.  
  2561.   if (t == Tree_NoTree) {
  2562.     return;
  2563.   }
  2564.   {
  2565.     register struct S_36 *W_71 = &yyTempo.U_1.V_1.yyR1;
  2566.  
  2567.     {
  2568.       register Tree_yClass *W_72 = &t->U_1.V_5.Class;
  2569.  
  2570.       if (Reporting) {
  2571.         Tree_ErrorI((LONGINT)CycleInWAG, t->U_1.V_5.Class.Pos, (LONGINT)Errors_Ident, ADR(W_72->Name));
  2572.         IO_WriteS((System_tFile)IO_StdOutput, (STRING)"Attribute Dependencies WAG", 26L);
  2573.         IO_WriteNl((System_tFile)IO_StdOutput);
  2574.         IO_WriteNl((System_tFile)IO_StdOutput);
  2575.         Tree_WriteDependencies(t, yyP7, Tree_MaxSet);
  2576.         IO_WriteS((System_tFile)IO_StdOutput, (STRING)"Cyclic Attributes", 17L);
  2577.         IO_WriteNl((System_tFile)IO_StdOutput);
  2578.         IO_WriteNl((System_tFile)IO_StdOutput);
  2579.         Sets_MakeSet(&Cyclics, (LONGCARD)W_72->InstCount);
  2580.         Relations_GetCyclics(yyP7, &Cyclics);
  2581.         Tree_WriteCyclics(ActClass, Cyclics);
  2582.         IO_WriteNl((System_tFile)IO_StdOutput);
  2583.         Sets_ReleaseSet(&Cyclics);
  2584.       } else {
  2585.         if (IN(Tree_Referenced, W_72->Properties) || W_72->BaseClass->U_1.V_1.Kind == Tree_NoClass) {
  2586.           Relations_Closure(&yyP7);
  2587.           if (Relations_HasReflexive(yyP7)) {
  2588.             Sets_Include(&HasCycle, (LONGCARD)W_72->Index);
  2589.           }
  2590.           Relations_MakeRelation(&W_71->B, (LONGINT)W_72->AttrCount, (LONGINT)W_72->AttrCount);
  2591.           {
  2592.             SHORTCARD B_113 = 2, B_114 = W_72->AttrCount;
  2593.  
  2594.             if (B_113 <= B_114)
  2595.               for (i = B_113;; i += 1) {
  2596.                 {
  2597.                   SHORTCARD B_115 = 2, B_116 = W_72->AttrCount;
  2598.  
  2599.                   if (B_115 <= B_116)
  2600.                     for (j = B_115;; j += 1) {
  2601.                       if (Relations_IsRelated((LONGINT)i, (LONGINT)j, yyP7)) {
  2602.                         Relations_Include(&W_71->B, (LONGINT)i, (LONGINT)j);
  2603.                       }
  2604.                       if (j >= B_116) break;
  2605.                     }
  2606.                 }
  2607.                 if (i >= B_114) break;
  2608.               }
  2609.           }
  2610.           if (Relations_IsEmpty(W_71->B)) {
  2611.             Relations_ReleaseRelation(&W_71->B);
  2612.             return;
  2613.           }
  2614.           W_71->ActD = W_72->D;
  2615.           while (W_71->ActD != NIL) {
  2616.             if (Relations_IsSubset(W_71->B, W_71->ActD->Relation)) {
  2617.               Relations_ReleaseRelation(&W_71->B);
  2618.               return;
  2619.             }
  2620.             W_71->ActD = W_71->ActD->Next;
  2621.           }
  2622.           W_71->ActD = W_72->D;
  2623.           W_71->LastNext = (tSetOfRelPtrPtr)ADR(W_72->D);
  2624.           while (W_71->ActD != NIL) {
  2625.             if (Relations_IsSubset(W_71->ActD->Relation, W_71->B)) {
  2626.               W_71->ActD = W_71->ActD->Next;
  2627.               Memory_Free((LONGINT)sizeof(Tree_tSetOfRel), (ADDRESS)(*W_71->LastNext));
  2628.               *W_71->LastNext = W_71->ActD;
  2629.             } else {
  2630.               W_71->LastNext = (tSetOfRelPtrPtr)ADR(W_71->ActD->Next);
  2631.               W_71->ActD = W_71->ActD->Next;
  2632.             }
  2633.           }
  2634.           W_71->ActD = (Tree_tSetOfRelPtr)Memory_Alloc((LONGINT)sizeof(Tree_tSetOfRel));
  2635.           W_71->ActD->Next = W_72->D;
  2636.           W_71->ActD->Relation = W_71->B;
  2637.           W_72->D = W_71->ActD;
  2638.           {
  2639.             SHORTCARD B_117 = Sets_Minimum(&W_72->Users), B_118 = Sets_Maximum(&W_72->Users);
  2640.  
  2641.             if (B_117 <= B_118)
  2642.               for (UserIndex = B_117;; UserIndex += 1) {
  2643.                 if (Sets_IsElement((LONGCARD)UserIndex, &W_72->Users) && Sets_IsElement((LONGCARD)UserIndex, &Relevant)) {
  2644.                   Queue_Enqueue(UserIndex);
  2645.                 }
  2646.                 if (UserIndex >= B_118) break;
  2647.               }
  2648.           }
  2649.         }
  2650.         if (W_72->BaseClass->U_1.V_1.Kind != Tree_NoClass) {
  2651.           CheckWAG5(W_72->BaseClass, yyP7);
  2652.         }
  2653.       }
  2654.       return;
  2655.     }
  2656.   }
  2657. }
  2658.  
  2659. void Order_BeginOrder
  2660. # ifdef __STDC__
  2661. ()
  2662. # else
  2663. ()
  2664. # endif
  2665. {
  2666. }
  2667.  
  2668. void Order_CloseOrder
  2669. # ifdef __STDC__
  2670. ()
  2671. # else
  2672. ()
  2673. # endif
  2674. {
  2675. }
  2676.  
  2677. static void yyExit
  2678. # ifdef __STDC__
  2679. ()
  2680. # else
  2681. ()
  2682. # endif
  2683. {
  2684.   IO_CloseIO();
  2685.   Exit(1L);
  2686. }
  2687.  
  2688. void BEGIN_Order()
  2689. {
  2690.   static BOOLEAN has_been_called = FALSE;
  2691.  
  2692.   if (!has_been_called) {
  2693.     has_been_called = TRUE;
  2694.  
  2695.     BEGIN_IO();
  2696.     BEGIN_Tree();
  2697.     BEGIN_System();
  2698.     BEGIN_IO();
  2699.     BEGIN_Tree();
  2700.     BEGIN_Memory();
  2701.     BEGIN_DynArray();
  2702.     BEGIN_IO();
  2703.     BEGIN_Idents();
  2704.     BEGIN_Sets();
  2705.     BEGIN_Relations();
  2706.     BEGIN_Queue();
  2707.     BEGIN_Tree();
  2708.     BEGIN_Optimize();
  2709.     BEGIN_Sets();
  2710.     BEGIN_Relations();
  2711.     BEGIN_Queue();
  2712.     BEGIN_Errors();
  2713.  
  2714.     Order_yyf = IO_StdOutput;
  2715.     Order_Exit = yyExit;
  2716.     Order_BeginOrder();
  2717.   }
  2718. }
  2719.